diff options
author | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2016-11-10 05:08:24 +0000 |
---|---|---|
committer | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2016-11-14 02:15:35 +0000 |
commit | 926ab34220431de2561c17269d473f8fc8f33217 (patch) | |
tree | 1b3caab92f0a59adc3c8acebe4b8a31626ec8152 /api | |
parent | d23cea2d7c95b0d6683fbd80abcdb65e303816a4 (diff) |
config: use struct type instead of []byte for capability and open msg
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'api')
-rw-r--r-- | api/grpc_server.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/api/grpc_server.go b/api/grpc_server.go index af16dccf..3ccfa4cc 100644 --- a/api/grpc_server.go +++ b/api/grpc_server.go @@ -107,6 +107,15 @@ func (s *Server) GetNeighbor(ctx context.Context, arg *GetNeighborRequest) (*Get if pconf.Transport.State.LocalAddress != "" { localAddress = pconf.Transport.State.LocalAddress } + var remoteCap, localCap [][]byte + for _, cap := range pconf.State.RemoteCapabilityList { + c, _ := cap.Serialize() + remoteCap = append(remoteCap, c) + } + for _, cap := range pconf.State.LocalCapabilityList { + c, _ := cap.Serialize() + localCap = append(localCap, c) + } return &Peer{ Conf: &PeerConf{ NeighborAddress: pconf.Config.NeighborAddress, @@ -120,8 +129,8 @@ func (s *Server) GetNeighbor(ctx context.Context, arg *GetNeighborRequest) (*Get SendCommunity: uint32(pconf.Config.SendCommunity.ToInt()), Description: pconf.Config.Description, PeerGroup: pconf.Config.PeerGroup, - RemoteCap: s.Capabilities.RemoteList, - LocalCap: s.Capabilities.LocalList, + RemoteCap: remoteCap, + LocalCap: localCap, PrefixLimits: prefixLimits, LocalAddress: localAddress, NeighborInterface: pconf.Config.NeighborInterface, |