Documentation
¶
Index ¶
- Variables
- type Binder
- type Client
- func (c *Client) Close() error
- func (c *Client) Destination(ctx context.Context, cfg DestinationConfig) (Destination, error)
- func (c *Client) DestinationHTTP(ctx context.Context, cfg DestinationConfig, handler http.Handler) error
- func (c *Client) DestinationHTTPProxy(ctx context.Context, cfg DestinationConfig, dstUrl *url.URL) error
- func (c *Client) DestinationHTTPSProxy(ctx context.Context, cfg DestinationConfig, dstUrl *url.URL, ...) error
- func (c *Client) DestinationTCP(ctx context.Context, cfg DestinationConfig, addr string) error
- func (c *Client) DestinationTLS(ctx context.Context, cfg DestinationConfig, addr string, cas *x509.CertPool) error
- func (c *Client) Destinations() []string
- func (c *Client) GetDestination(name string) (Destination, error)
- func (c *Client) GetSource(name string) (Source, error)
- func (c *Client) Source(ctx context.Context, cfg SourceConfig) (Source, error)
- func (c *Client) SourceHTTP(ctx context.Context, cfg SourceConfig, srcURL *url.URL) error
- func (c *Client) SourceHTTPS(ctx context.Context, cfg SourceConfig, srcURL *url.URL, cert tls.Certificate) error
- func (c *Client) SourceTCP(ctx context.Context, cfg SourceConfig, addr string) error
- func (c *Client) SourceTLS(ctx context.Context, cfg SourceConfig, addr string, cert tls.Certificate) error
- func (c *Client) Sources() []string
- func (c *Client) Status(ctx context.Context) (ClientStatus, error)
- type ClientOption
- func ClientControlAddress(address string) ClientOption
- func ClientControlCAs(certFile string) ClientOption
- func ClientDirectAddress(address string) ClientOption
- func ClientDirectStatelessResetKey(key *quic.StatelessResetKey) ClientOption
- func ClientDirectStatelessResetKeyFile(path string) ClientOption
- func ClientLogger(logger *slog.Logger) ClientOption
- func ClientToken(token string) ClientOption
- type ClientStatus
- type Destination
- type DestinationConfig
- type EndpointStatus
- type HTTPDestination
- type HTTPSource
- type Server
- type ServerOption
- func ServerCertificate(certFile, keyFile string) ServerOption
- func ServerClientAuthenticator(clientsAuth control.ClientAuthenticator) ServerOption
- func ServerClientRestrictions(allow []string, deny []string) ServerOption
- func ServerClientTokens(tokens ...string) ServerOption
- func ServerClientsAddress(address string) ServerOption
- func ServerLogger(logger *slog.Logger) ServerOption
- func ServerRelayAddress(address string) ServerOption
- func ServerRelayHostname(hostname string) ServerOption
- func ServerStoreDir(dir string) ServerOption
- type ServerStatus
- type Source
- type SourceConfig
- type TCPDestination
- type TCPSource
- type WSSource
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoActiveDestinations = client.ErrNoActiveDestinations ErrNoDialedDestinations = client.ErrNoDialedDestinations )
var NewDestinationConfig = client.NewDestinationConfig
NewDestinationConfig creates a destination config for a given name. See client.NewDestinationConfig
var NewSourceConfig = client.NewSourceConfig
NewSourceConfig creates a destination config for a given name. See client.NewSourceConfig
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func Connect ¶ added in v0.7.0
func Connect(ctx context.Context, opts ...ClientOption) (*Client, error)
Connect starts a new client and connects it to the control server. This call blocks until the server is connected or an error is detected. The client can be stopped either by canceling this context or via calling Close. Stopping the client will also stop all active source/destinations associated with this client
func (*Client) Close ¶ added in v0.7.0
Close closes this client. It disconnects the client and all endpoints (destinations and sources) associated with it.
func (*Client) Destination ¶ added in v0.7.0
func (c *Client) Destination(ctx context.Context, cfg DestinationConfig) (Destination, error)
Destination starts a new destination with a given configuration. This call blocks until it is successfully announced to the control server. The destination can be closed either via cancelling the context or calling its close func.
func (*Client) DestinationHTTP ¶ added in v0.7.0
func (c *Client) DestinationHTTP(ctx context.Context, cfg DestinationConfig, handler http.Handler) error
DestinationHTTP creates a new destination which exposes an HTTP server for a given http.Handler
func (*Client) DestinationHTTPProxy ¶ added in v0.7.0
func (c *Client) DestinationHTTPProxy(ctx context.Context, cfg DestinationConfig, dstUrl *url.URL) error
DestinationHTTPProxy creates a new destination which exposes an HTTP proxy server to another HTTP server
func (*Client) DestinationHTTPSProxy ¶ added in v0.7.0
func (c *Client) DestinationHTTPSProxy(ctx context.Context, cfg DestinationConfig, dstUrl *url.URL, cas *x509.CertPool) error
DestinationHTTPSProxy creates a new destination which exposes an HTTP proxy server to another HTTPS server
func (*Client) DestinationTCP ¶ added in v0.7.0
DestinationTCP creates a new destination which connects to a downstream TCP server
func (*Client) DestinationTLS ¶ added in v0.7.0
func (c *Client) DestinationTLS(ctx context.Context, cfg DestinationConfig, addr string, cas *x509.CertPool) error
DestinationTLS creates a new destination which connects to a downstream TLS server
func (*Client) Destinations ¶ added in v0.7.0
Destinations returns the set of currently active destinations
func (*Client) GetDestination ¶ added in v0.7.0
func (c *Client) GetDestination(name string) (Destination, error)
GetDestination returns a destination by its name. Returns an error if the destination was not found.
func (*Client) GetSource ¶ added in v0.7.0
GetSource returns a source by its name. Returns an error if the source was not found.
func (*Client) Source ¶ added in v0.7.0
Source starts a new source with a given configuration. This call blocks until it is successfully announced to the control server. The source can be closed either via cancelling the context or calling its close func.
func (*Client) SourceHTTP ¶ added in v0.7.0
SourceHTTP creates a new source, and exposes it to local TCP address as an HTTP server
func (*Client) SourceHTTPS ¶ added in v0.7.0
func (c *Client) SourceHTTPS(ctx context.Context, cfg SourceConfig, srcURL *url.URL, cert tls.Certificate) error
SourceHTTPS creates a new source, and exposes it to local TCP address as an HTTPS server
func (*Client) SourceTCP ¶ added in v0.7.0
SourceTCP creates a new source, and exposes it to a local TCP address to accept incoming traffic
func (*Client) SourceTLS ¶ added in v0.7.0
func (c *Client) SourceTLS(ctx context.Context, cfg SourceConfig, addr string, cert tls.Certificate) error
SourceTLS creates a new source, and exposes it to local TCP address as a TLS server
type ClientOption ¶
type ClientOption func(cfg *clientConfig) error
func ClientControlAddress ¶
func ClientControlAddress(address string) ClientOption
func ClientControlCAs ¶
func ClientControlCAs(certFile string) ClientOption
func ClientDirectAddress ¶
func ClientDirectAddress(address string) ClientOption
func ClientDirectStatelessResetKey ¶ added in v0.6.0
func ClientDirectStatelessResetKey(key *quic.StatelessResetKey) ClientOption
func ClientDirectStatelessResetKeyFile ¶ added in v0.6.0
func ClientDirectStatelessResetKeyFile(path string) ClientOption
func ClientLogger ¶
func ClientLogger(logger *slog.Logger) ClientOption
func ClientToken ¶
func ClientToken(token string) ClientOption
type ClientStatus ¶ added in v0.4.0
type ClientStatus struct { Status statusc.Status `json:"status"` Destinations map[model.Forward]EndpointStatus `json:"destinations"` Sources map[model.Forward]EndpointStatus `json:"sources"` }
type Destination ¶ added in v0.7.0
type Destination interface { Config() DestinationConfig Context() context.Context Accept() (net.Conn, error) AcceptContext(ctx context.Context) (net.Conn, error) Client() *Client Status(ctx context.Context) (EndpointStatus, error) Addr() net.Addr Close() error }
Destination is type of endpoint that can receive remote connections and traffic. It implements net.Listener interface, so it
type DestinationConfig ¶ added in v0.7.0
type DestinationConfig = client.DestinationConfig
DestinationConfig structure represents destination configuration. See [Client.DestinationConfig]
type EndpointStatus ¶ added in v0.7.0
type EndpointStatus struct { Status statusc.Status Peer client.PeerStatus }
type HTTPDestination ¶ added in v0.7.0
type HTTPDestination struct {
// contains filtered or unexported fields
}
func NewHTTPDestination ¶ added in v0.7.0
func NewHTTPDestination(dst Destination, handler http.Handler) *HTTPDestination
func NewHTTPFileDestination ¶ added in v0.7.0
func NewHTTPFileDestination(dst Destination, root string) *HTTPDestination
func NewHTTPProxyDestination ¶ added in v0.7.0
func NewHTTPProxyDestination(dst Destination, dstURL *url.URL, cfg *tls.Config) *HTTPDestination
type HTTPSource ¶ added in v0.7.0
type HTTPSource struct {
// contains filtered or unexported fields
}
func NewHTTPSource ¶ added in v0.7.0
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(opts ...ServerOption) (*Server, error)
type ServerOption ¶
type ServerOption func(*serverConfig) error
func ServerCertificate ¶ added in v0.5.0
func ServerCertificate(certFile, keyFile string) ServerOption
func ServerClientAuthenticator ¶ added in v0.5.0
func ServerClientAuthenticator(clientsAuth control.ClientAuthenticator) ServerOption
func ServerClientRestrictions ¶ added in v0.4.0
func ServerClientRestrictions(allow []string, deny []string) ServerOption
func ServerClientTokens ¶
func ServerClientTokens(tokens ...string) ServerOption
func ServerClientsAddress ¶ added in v0.5.0
func ServerClientsAddress(address string) ServerOption
func ServerLogger ¶
func ServerLogger(logger *slog.Logger) ServerOption
func ServerRelayAddress ¶
func ServerRelayAddress(address string) ServerOption
func ServerRelayHostname ¶
func ServerRelayHostname(hostname string) ServerOption
func ServerStoreDir ¶
func ServerStoreDir(dir string) ServerOption
type ServerStatus ¶ added in v0.4.0
type SourceConfig ¶ added in v0.7.0
type SourceConfig = client.SourceConfig
SourceConfig structure represents source configuration. See [Client.SourceConfig]
type TCPDestination ¶ added in v0.7.0
type TCPDestination struct {
// contains filtered or unexported fields
}
func NewTCPDestination ¶ added in v0.7.0
func NewTCPDestination(dst Destination, addr string, logger *slog.Logger) *TCPDestination
func NewTLSDestination ¶ added in v0.7.0
func NewTLSDestination(dst Destination, addr string, cfg *tls.Config, logger *slog.Logger) *TCPDestination
type TCPSource ¶ added in v0.7.0
type TCPSource struct {
// contains filtered or unexported fields
}
func NewTCPSource ¶ added in v0.7.0
func NewTLSSource ¶ added in v0.7.0
type WSSource ¶ added in v0.7.0
type WSSource struct {
// contains filtered or unexported fields
}