birpc

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2018 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(conf *ClientConfig) (*Client, error)

func (*Client) Close

func (cli *Client) Close() error

func (*Client) Run

func (cli *Client) Run(handler ClientHandler) error

Run starts communicating with server, do reconnecting and requests dispatching logic.

type ClientConfig

type ClientConfig struct {
	ID                string
	Hash              string
	RemoteAddr        string
	HeartbeatInterval time.Duration
	Timeout           util.TimeoutConfig
	Retrier           *retry.Retrier
	TLSConf           *tls.Config
}

type ClientConn

type ClientConn struct {
	*Conn
	ID      string
	Hash    string
	Version string
	Device  string
}

type ClientHandler

type ClientHandler interface {
	HandlePingResponse(req *msgpb.PingResponse)
	HandleNewTunnelRequest(req *msgpb.NewTunnelRequest) *msgpb.NewTunnelResponse
	HandleCloseTunnelRequest(req *msgpb.CloseTunnelRequest) *msgpb.CloseTunnelResponse
	HandleShutdownRequest(req *msgpb.ShutdownRequest) bool
	HandleUnknownMessage(m interface{})
	HandleError(err error)
}

type Conn

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

func NewConn

func NewConn(conn net.Conn, rdTimeout time.Duration, wrTimeout time.Duration) *Conn

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Err

func (c *Conn) Err() <-chan error

func (*Conn) Go

func (c *Conn) Go()

func (*Conn) In

func (c *Conn) In() <-chan interface{}

func (*Conn) Out

func (c *Conn) Out() chan<- interface{}

type Server

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

func NewServer

func NewServer(conf *ServerConfig) (*Server, error)

func (*Server) Clients

func (s *Server) Clients() <-chan *ClientConn

func (*Server) Close

func (s *Server) Close() error

func (*Server) Serve

func (s *Server) Serve() error

type ServerConfig

type ServerConfig struct {
	ListenAddr   string
	Timeout      util.TimeoutConfig
	TLSConf      *tls.Config
	ValidateFunc ValidateFunc
}

type ValidateFunc

type ValidateFunc func(id, hash, device, version string) msgpb.ErrCode

Jump to

Keyboard shortcuts

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