connector

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddrTypeV4 byte = 0x01
	AddrTypeV6 byte = 02
)
View Source
const (
	ProtocolName               = "lc1"
	DefaultCertificatePassword = "ZRechGaCSqBPdtTZ599Ivw"
)
View Source
const (
	OpcodeDial uint8 = 1 + iota
	OpcodeDialSuccess
	OpcodePacket
	OpcodeHeartbeat
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

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

func NewAgent

func NewAgent(cert *x509.Certificate, privateKey crypto.PrivateKey, caCert []*x509.Certificate, backend string) *Agent

func (*Agent) Connect

func (a *Agent) Connect(host string) error

func (*Agent) Serve

func (a *Agent) Serve() error

type Conn

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

func NewConn

func NewConn(conn *tls.Conn, streamId uint32, r io.ReadCloser, remoteAddr *net.TCPAddr) *Conn

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

func (*Conn) Read

func (c *Conn) Read(b []byte) (n int, err error)

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) Write

func (c *Conn) Write(b []byte) (n int, err error)

type ConnThroughRelay

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

func NewConnThroughRelay

func NewConnThroughRelay(ctx context.Context, conn *tls.Conn) (*ConnThroughRelay, error)

func (*ConnThroughRelay) Close

func (c *ConnThroughRelay) Close() error

func (*ConnThroughRelay) LocalAddr

func (c *ConnThroughRelay) LocalAddr() net.Addr

func (*ConnThroughRelay) Read

func (c *ConnThroughRelay) Read(b []byte) (n int, err error)

func (*ConnThroughRelay) RemoteAddr

func (c *ConnThroughRelay) RemoteAddr() net.Addr

func (*ConnThroughRelay) SetDeadline

func (c *ConnThroughRelay) SetDeadline(t time.Time) error

func (*ConnThroughRelay) SetReadDeadline

func (c *ConnThroughRelay) SetReadDeadline(t time.Time) error

func (*ConnThroughRelay) SetWriteDeadline

func (c *ConnThroughRelay) SetWriteDeadline(t time.Time) error

func (*ConnThroughRelay) Write

func (c *ConnThroughRelay) Write(b []byte) (n int, err error)

type ConnectionManager

type ConnectionManager struct {
	MaxConnsPerHost int
	// contains filtered or unexported fields
}

func NewConnectionManager

func NewConnectionManager(conf *config.Config, locator database.RelayLocator) *ConnectionManager

func (*ConnectionManager) GetConn

func (p *ConnectionManager) GetConn(name string) (*tls.Conn, error)

type Dialer

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

func NewDialer

func NewDialer(s *Server, name string) *Dialer

func (*Dialer) DialContext

func (d *Dialer) DialContext(ctx context.Context, _network, _addr string) (net.Conn, error)

type Frame

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

func NewFrame

func NewFrame() *Frame

func (*Frame) EncodeTo

func (f *Frame) EncodeTo(opCode uint8, w io.Writer) (n int, err error)

func (*Frame) Reset

func (f *Frame) Reset()

func (*Frame) Write

func (f *Frame) Write(b []byte) (n int, err error)

type Relay

type Relay struct {
	Addr *net.TCPAddr
	// contains filtered or unexported fields
}

func NewRelay

func NewRelay(client *rpcclient.Client, name string, server *Server, conn *tls.Conn) (*Relay, error)

func (*Relay) Close

func (r *Relay) Close()

func (*Relay) Serve

func (r *Relay) Serve() error

type Server

type Server struct {
	Config  *config.Config
	Locator database.RelayLocator
	Pool    *ConnectionManager
	// contains filtered or unexported fields
}

func NewServer

func NewServer(conf *config.Config, rpcConn *grpc.ClientConn, locator database.RelayLocator) *Server

func (*Server) Accept

func (s *Server) Accept(_ *http.Server, conn *tls.Conn, _ http.Handler)

func (*Server) DialUpstream

func (s *Server) DialUpstream(ctx context.Context, name string) (net.Conn, error)

func (*Server) DialUpstreamForRelay

func (s *Server) DialUpstreamForRelay(ctx context.Context, name string, w io.Writer, dialId uint32) (uint32, *net.TCPAddr, error)

func (*Server) RoundTrip

func (s *Server) RoundTrip(backend *config.Backend, req *http.Request) (*http.Response, error)

func (*Server) Serve

func (s *Server) Serve(conn net.Conn) error

type Stream

type Stream struct{}

Jump to

Keyboard shortcuts

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