handler

package
v0.0.0-...-d238303 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Listen

func Listen(network, address string, onClose func()) (net.Listener, error)

Types

type Client

type Client struct {
	NewPubConnNotifyCH chan Token
	// contains filtered or unexported fields
}

func NewClient

func NewClient(name, displayName, host, pubPort, intPort string, sharePub bool, l *log.Entry) (*Client, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) IntAddr

func (c *Client) IntAddr() string

func (*Client) IntBindAddr

func (c *Client) IntBindAddr() string

func (*Client) PubAddr

func (c *Client) PubAddr() string

func (*Client) PubBindAddr

func (c *Client) PubBindAddr() string

func (*Client) SetSTUNInfo

func (c *Client) SetSTUNInfo(host, backendPort, protocol string)

func (*Client) Start

func (c *Client) Start()

type Handler

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

func New

func New(host string) *Handler

func (*Handler) Close

func (h *Handler) Close()

func (*Handler) CreateClient

CreateClient creates a new internal listener for clients. Whether public listener is unique depends on request parameter.

func (*Handler) ListClients

func (h *Handler) ListClients(ctx context.Context, req *api.ListClientsRequest) (*api.ListClientsResponse, error)

func (*Handler) ListInternalService

func (*Handler) StartInternalService

func (h *Handler) StartInternalService(ctx context.Context, req *api.StartInternalServiceRequest) (*api.InternalService, error)

type InternalService

type InternalService struct {
	PublicPort  int32
	Name        string
	Close       func()
	ServiceName string
	Addr        string
}

type PairedConn

type PairedConn struct {
	SRC, DEST net.Conn
	SpeedIn   float64
	SpeedOut  float64
	OnClose   func()
	// contains filtered or unexported fields
}

func NewPairedConn

func NewPairedConn(src, dst net.Conn) *PairedConn

func (*PairedConn) Close

func (pc *PairedConn) Close()

func (*PairedConn) Copy

func (pc *PairedConn) Copy()

func (*PairedConn) String

func (pc *PairedConn) String() string

type SharedListener

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

SharedListener uses reference count to ensure listening on the same address will success. SO_REUSEPORT ?

func (*SharedListener) Accept

func (sl *SharedListener) Accept() (net.Conn, error)

func (*SharedListener) Addr

func (sl *SharedListener) Addr() net.Addr

func (*SharedListener) Close

func (sl *SharedListener) Close() error

type Token

type Token int

func (Token) Len

func (t Token) Len() int

func (Token) String

func (t Token) String() string

Jump to

Keyboard shortcuts

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