diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-12-17 15:50:54 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-12-17 15:50:54 -0800 |
commit | 1b5d53c411f71209263b8f590ca317802f89621f (patch) | |
tree | bad5213b4c4a295b309172acd07105496618771a /server/rpki.go | |
parent | 319a8743382f6057a2732617d1e663d531240c45 (diff) |
rpki: remove unused member
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/rpki.go')
-rw-r--r-- | server/rpki.go | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/server/rpki.go b/server/rpki.go index a50939ac..326203ec 100644 --- a/server/rpki.go +++ b/server/rpki.go @@ -64,6 +64,31 @@ type roaManager struct { clientMap map[string]*roaClient } +func newROAManager(as uint32, conf config.RpkiServers) (*roaManager, error) { + m := &roaManager{ + AS: as, + roas: make(map[bgp.RouteFamily]*radix.Tree), + config: conf, + } + m.roas[bgp.RF_IPv4_UC] = radix.New() + m.roas[bgp.RF_IPv6_UC] = radix.New() + m.eventCh = make(chan *roaClientEvent) + m.clientMap = make(map[string]*roaClient) + + for _, entry := range conf.RpkiServerList { + c := entry.RpkiServerConfig + client := &roaClient{ + host: net.JoinHostPort(c.Address.String(), strconv.Itoa(int(c.Port))), + eventCh: m.eventCh, + state: &entry.RpkiServerState, + } + m.clientMap[client.host] = client + client.t.Go(client.tryConnect) + } + + return m, nil +} + func (c *roaManager) recieveROA() chan *roaClientEvent { return c.eventCh } @@ -193,9 +218,10 @@ func (c *roaManager) handleGRPC(grpcReq *GrpcRequest) { for _, client := range c.clientMap { state := client.state received := &state.RpkiMessages.RpkiReceived + addr, _ := splitHostPort(client.host) rpki := &api.RPKI{ Conf: &api.RPKIConf{ - Address: client.addr, + Address: addr, }, State: &api.RPKIState{ Uptime: state.Uptime, @@ -318,7 +344,6 @@ func (c *roaManager) validate(pathList []*table.Path) { type roaClient struct { t tomb.Tomb host string - addr string conn *net.TCPConn state *config.RpkiServerState eventCh chan *roaClientEvent @@ -382,29 +407,3 @@ func (c *roaClient) established() error { disconnected() return nil } - -func newROAManager(as uint32, conf config.RpkiServers) (*roaManager, error) { - m := &roaManager{ - AS: as, - roas: make(map[bgp.RouteFamily]*radix.Tree), - config: conf, - } - m.roas[bgp.RF_IPv4_UC] = radix.New() - m.roas[bgp.RF_IPv6_UC] = radix.New() - m.eventCh = make(chan *roaClientEvent) - m.clientMap = make(map[string]*roaClient) - - for _, entry := range conf.RpkiServerList { - c := entry.RpkiServerConfig - client := &roaClient{ - host: net.JoinHostPort(c.Address.String(), strconv.Itoa(int(c.Port))), - addr: c.Address.String(), - eventCh: m.eventCh, - state: &entry.RpkiServerState, - } - m.clientMap[client.host] = client - client.t.Go(client.tryConnect) - } - - return m, nil -} |