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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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