diff options
Diffstat (limited to 'server/grpc_server.go')
-rw-r--r-- | server/grpc_server.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/server/grpc_server.go b/server/grpc_server.go index 4a652c4f..a4e61be7 100644 --- a/server/grpc_server.go +++ b/server/grpc_server.go @@ -83,6 +83,7 @@ const ( REQ_MONITOR_GLOBAL_BEST_CHANGED REQ_MONITOR_NEIGHBOR_PEER_STATE REQ_MRT_GLOBAL_RIB + REQ_RPKI ) const GRPC_PORT = 8080 @@ -621,6 +622,26 @@ END: return err } +func (s *Server) GetRPKI(arg *api.Arguments, stream api.Grpc_GetRPKIServer) error { + rf, err := convertAf2Rf(arg.Af) + if err != nil { + return err + } + req := NewGrpcRequest(REQ_RPKI, "", rf, nil) + s.bgpServerCh <- req + + for res := range req.ResponseCh { + if err := res.Err(); err != nil { + log.Debug(err.Error()) + return err + } + if err := stream.Send(res.Data.(*api.ROA)); err != nil { + return err + } + } + return nil +} + type GrpcRequest struct { RequestType int RemoteAddr string |