proxy

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: Apache-2.0 Imports: 15 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 global logger level to lvl.

func SetLogger

func SetLogger(l *logrus.Logger)

SetLogger sets global logger to l.

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) 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   []string
	IncompatibleMsgs []string
}

type BinapiRPC

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

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

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) Compatibility

func (*BinapiRPC) Connect

func (s *BinapiRPC) Connect(binapi adapter.VppAPI) error

func (*BinapiRPC) Disconnect

func (s *BinapiRPC) Disconnect()

func (*BinapiRPC) Invoke

func (s *BinapiRPC) Invoke(req BinapiRequest, resp *BinapiResponse) 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 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) 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) Connect

func (s *StatsRPC) Connect(stats adapter.StatsAPI) error

func (*StatsRPC) Disconnect

func (s *StatsRPC) Disconnect()

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
}

Jump to

Keyboard shortcuts

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