proxy

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2022 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogLevel

func SetLogLevel(lvl logrus.Level)

SetLogLevel sets log level for logger.

func SetLogOutput added in v0.3.3

func SetLogOutput(out io.Writer)

SetOutput sets log output for logger.

func SetLogger

func SetLogger(l *logrus.Logger)

SetLogger sets logger.

Types

type BinapiClient

type BinapiClient struct {
	// contains filtered or unexported fields
}

func (*BinapiClient) CheckCompatiblity

func (b *BinapiClient) CheckCompatiblity(msgs ...api.Message) error

func (*BinapiClient) Close

func (b *BinapiClient) Close()

func (*BinapiClient) Invoke added in v0.4.0

func (b *BinapiClient) Invoke(_ context.Context, request api.Message, reply api.Message) error

func (*BinapiClient) NewStream added in v0.4.0

func (b *BinapiClient) NewStream(_ context.Context, _ ...api.StreamOption) (api.Stream, error)

func (*BinapiClient) SendMultiRequest

func (b *BinapiClient) SendMultiRequest(msg api.Message) api.MultiRequestCtx

func (*BinapiClient) SendRequest

func (b *BinapiClient) SendRequest(msg api.Message) api.RequestCtx

func (*BinapiClient) SetReplyTimeout

func (b *BinapiClient) SetReplyTimeout(timeout time.Duration)

func (*BinapiClient) SubscribeNotification

func (b *BinapiClient) SubscribeNotification(notifChan chan api.Message, event api.Message) (api.SubscriptionCtx, error)

type BinapiCompatibilityRequest

type BinapiCompatibilityRequest struct {
	MsgNameCrcs []string
}

type BinapiCompatibilityResponse

type BinapiCompatibilityResponse struct {
	CompatibleMsgs   map[string][]string
	IncompatibleMsgs map[string][]string
}

type BinapiRPC

type BinapiRPC struct {
	// contains filtered or unexported fields
}

BinapiRPC is a RPC server for proxying client request to api.Channel or api.Stream.

func NewBinapiRPC

func NewBinapiRPC(binapi adapter.VppAPI) (*BinapiRPC, error)

NewBinapiRPC returns new BinapiRPC to be used as RPC server proxying request to given api.Channel.

func (*BinapiRPC) CloseStream added in v0.4.0

func (s *BinapiRPC) CloseStream(req RPCStreamReqResp, resp *RPCStreamReqResp) error

func (*BinapiRPC) Compatibility

func (*BinapiRPC) Invoke

func (s *BinapiRPC) Invoke(req BinapiRequest, resp *BinapiResponse) error

func (*BinapiRPC) NewAPIStream added in v0.4.0

func (s *BinapiRPC) NewAPIStream(req RPCStreamReqResp, resp *RPCStreamReqResp) error

func (*BinapiRPC) ReceiveMessage added in v0.4.0

func (s *BinapiRPC) ReceiveMessage(req RPCStreamReqResp, resp *RPCStreamReqResp) error

func (*BinapiRPC) SendMessage added in v0.4.0

func (s *BinapiRPC) SendMessage(req RPCStreamReqResp, resp *RPCStreamReqResp) error

type BinapiRequest

type BinapiRequest struct {
	Msg      api.Message
	IsMulti  bool
	ReplyMsg api.Message
	Timeout  time.Duration
}

type BinapiResponse

type BinapiResponse struct {
	Msg  api.Message
	Msgs []api.Message
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func Connect

func Connect(addr string) (*Client, error)

Connect dials remote proxy server on given address and returns new client if successful.

func (*Client) NewBinapiClient

func (c *Client) NewBinapiClient() (*BinapiClient, error)

NewBinapiClient returns new BinapiClient which implements api.Channel.

func (*Client) NewStatsClient

func (c *Client) NewStatsClient() (*StatsClient, error)

NewStatsClient returns new StatsClient which implements api.StatsProvider.

type RPCStream added in v0.4.0

type RPCStream struct {
	// contains filtered or unexported fields
}

RPCStream is a stream for forwarding requests to BinapiRPC's stream.

func (*RPCStream) Close added in v0.4.0

func (s *RPCStream) Close() error

func (*RPCStream) RecvMsg added in v0.4.0

func (s *RPCStream) RecvMsg() (api.Message, error)

func (*RPCStream) SendMsg added in v0.4.0

func (s *RPCStream) SendMsg(msg api.Message) error

type RPCStreamReqResp added in v0.4.0

type RPCStreamReqResp struct {
	ID  uint32
	Msg api.Message
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server defines a proxy server that serves client requests to stats and binapi.

func NewServer

func NewServer() (*Server, error)

func (*Server) ConnectBinapi

func (p *Server) ConnectBinapi(binapi adapter.VppAPI) error

func (*Server) ConnectStats

func (p *Server) ConnectStats(stats adapter.StatsAPI) error

func (*Server) DisconnectBinapi

func (p *Server) DisconnectBinapi()

func (*Server) DisconnectStats

func (p *Server) DisconnectStats()

func (*Server) ListenAndServe

func (p *Server) ListenAndServe(addr string) error

func (*Server) ServeCodec

func (p *Server) ServeCodec(codec rpc.ServerCodec)

func (*Server) ServeConn

func (p *Server) ServeConn(conn io.ReadWriteCloser)

func (*Server) ServeHTTP

func (p *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

type StatsClient

type StatsClient struct {
	// contains filtered or unexported fields
}

func (*StatsClient) GetBufferStats

func (s *StatsClient) GetBufferStats(bufStats *api.BufferStats) error

func (*StatsClient) GetErrorStats

func (s *StatsClient) GetErrorStats(errStats *api.ErrorStats) error

func (*StatsClient) GetInterfaceStats

func (s *StatsClient) GetInterfaceStats(ifaceStats *api.InterfaceStats) error

func (*StatsClient) GetMemoryStats added in v0.4.0

func (s *StatsClient) GetMemoryStats(memStats *api.MemoryStats) error

func (*StatsClient) GetNodeStats

func (s *StatsClient) GetNodeStats(nodeStats *api.NodeStats) error

func (*StatsClient) GetSystemStats

func (s *StatsClient) GetSystemStats(sysStats *api.SystemStats) error

type StatsRPC

type StatsRPC struct {
	// contains filtered or unexported fields
}

StatsRPC is a RPC server for proxying client request to api.StatsProvider.

func NewStatsRPC

func NewStatsRPC(stats adapter.StatsAPI) (*StatsRPC, error)

NewStatsRPC returns new StatsRPC to be used as RPC server proxying request to given api.StatsProvider.

func (*StatsRPC) GetStats

func (s *StatsRPC) GetStats(req StatsRequest, resp *StatsResponse) error

type StatsRequest

type StatsRequest struct {
	StatsType string
}

type StatsResponse

type StatsResponse struct {
	SysStats   *api.SystemStats
	NodeStats  *api.NodeStats
	IfaceStats *api.InterfaceStats
	ErrStats   *api.ErrorStats
	BufStats   *api.BufferStats
	MemStats   *api.MemoryStats
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL