peer

package
v0.0.0-...-5c79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 34 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 {
	sync.RWMutex
	// contains filtered or unexported fields
}

Client is a peer proxy service client using grpc and tls.

func NewClient

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

NewClient creats a new peer proxy client.

func (*Client) DialNode

func (c *Client) DialNode(
	proxyIDs []string,
	nodeID string,
	src net.Addr,
	dst net.Addr,
	tunnelType types.TunnelType,
) (net.Conn, error)

DialNode dials a node through a peer proxy.

func (*Client) GetConnectionsCount

func (c *Client) GetConnectionsCount() int

func (*Client) Shutdown

func (c *Client) Shutdown()

Shutdown gracefully shuts down all existing client connections.

func (*Client) Stop

func (c *Client) Stop() error

Stop closes all existing client connections.

type ClientConfig

type ClientConfig struct {
	// Context is a signaling context
	Context context.Context
	// ID is the ID of this server proxy
	ID string
	// AuthClient is an auth client
	AuthClient auth.ClientI
	// AccessPoint is a caching auth client
	AccessPoint auth.ProxyAccessPoint
	// TLSConfig is the proxy client TLS configuration.
	TLSConfig *tls.Config
	// Log is the proxy client logger.
	Log logrus.FieldLogger
	// Clock is used to control connection monitoring ticker.
	Clock clockwork.Clock
	// GracefulShutdownTimout is used set the graceful shutdown
	// duration limit.
	GracefulShutdownTimeout time.Duration
	// ClusterName is the name of the cluster.
	ClusterName string
	// contains filtered or unexported fields
}

ClientConfig configures a Client instance.

type ClusterDialer

type ClusterDialer interface {
	Dial(clusterName string, request DialParams) (net.Conn, error)
}

ClusterDialer dials a node in the given cluster.

type DialParams

type DialParams struct {
	From     *utils.NetAddr
	To       *utils.NetAddr
	ServerID string
	ConnType types.TunnelType
}

type Server

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

Server is a proxy service server using grpc and tls.

func NewServer

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

NewServer creates a new proxy server instance.

func (*Server) Close

func (s *Server) Close() error

Close closes the proxy server immediately.

func (*Server) Serve

func (s *Server) Serve() error

Serve starts the proxy server.

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown does a graceful shutdown of the proxy server.

type ServerConfig

type ServerConfig struct {
	AccessCache   auth.AccessCache
	Listener      net.Listener
	TLSConfig     *tls.Config
	ClusterDialer ClusterDialer
	Log           logrus.FieldLogger
	ClusterName   string
	// contains filtered or unexported fields
}

ServerConfig configures a Server instance.

Jump to

Keyboard shortcuts

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