コード例 #1
0
ファイル: ipc.go プロジェクト: Cepave/lvs-metrics
// BGPNeighbors returns a list of the BGP neighbors that we are peering with.
func (s *SeesawEngine) BGPNeighbors(ctx *ipc.Context, reply *quagga.Neighbors) error {
	s.trace("BGPNeighbors", ctx)
	if ctx == nil {
		return errors.New("context is nil")
	}

	if !ctx.IsTrusted() {
		return errors.New("insufficient access")
	}

	if reply == nil {
		return fmt.Errorf("Neighbors is nil")
	}
	s.engine.bgpManager.lock.RLock()
	reply.Neighbors = s.engine.bgpManager.neighbors
	s.engine.bgpManager.lock.RUnlock()
	return nil
}
コード例 #2
0
ファイル: control.go プロジェクト: Cepave/lvs-metrics
// BGPNeighbors returns a list of the BGP neighbors that we are peering with.
func (s *SeesawECU) BGPNeighbors(ctx *ipc.Context, reply *quagga.Neighbors) error {
	s.trace("BGPNeighbors", ctx)

	authConn, err := s.ecu.authConnect(ctx)
	if err != nil {
		return err
	}
	defer authConn.Close()

	neighbors, err := authConn.BGPNeighbors()
	if err != nil {
		return err
	}

	if reply != nil {
		reply.Neighbors = neighbors
	}
	return nil
}