Documentation ¶
Overview ¶
Copyright (c) technicianted. All rights reserved. Licensed under the MIT License.
Copyright (c) technicianted. All rights reserved. Licensed under the MIT License.
Copyright (c) technicianted. All rights reserved. Licensed under the MIT License.
Copyright (c) technicianted. All rights reserved. Licensed under the MIT License.
Index ¶
- Variables
- type Client
- func (c *Client) NewClient(options types.NewClientOptions, logger logging.TraceLogger) (types.ClientManager, error)
- func (c *Client) Resolve(ctx context.Context, hostname string) (addresses []string, err error)
- func (c *Client) Start(logger logging.TraceLogger) error
- func (c *Client) Stop(logger logging.TraceLogger) error
- type ClientOptions
- type WhipClient
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultReconciliationDuration is the default endpoint/client reconciliation interval. DefaultReconciliationDuration = 5 * time.Second )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a higher level whip client that wraps one or more whip clients, each connected to a single physical whip service instance. It continuously reconciles current connected clients with given endpoints and their resolved ip addresses and performs necessary operations to create or remove.
func NewClient ¶
func NewClient(options ClientOptions) *Client
NewClient creates a new client with options. Internally, it creates one or more clients each connected to a physical whip service instance.
func (*Client) NewClient ¶
func (c *Client) NewClient(options types.NewClientOptions, logger logging.TraceLogger) (types.ClientManager, error)
NewClient implement types.ClientFactory
type ClientOptions ¶
type ClientOptions struct { // WhipServiceEndpoints is an array of whip service grpc endpoints. Each one // will be resolved into 1 or more ip addresses and a whip client will be created // for each one of them. WhipServiceEndpoints []string // Hostname is the client hostname. It will be used in registration with whip service. // It does not need to match the actual hostname. Hostname string // Domain is the client domain name. It will be used in registration with whip service. // It does not need to match the actual hostname. In fact it is recommended not to use // common, publicly accessible domains. Domain string // Ports is a list of published tcp ports that this client is willing to accept connections // to. Ports []int // GRPCDialOptions is a list of grpc dial options to be used when dialing to whip service // grpc. GRPCDialOptions []grpc.DialOption // TLS enables the use of tls for both grpc control connection to whip server, and reverse // tunneled tcp connections. TLS bool // TLSKeyPath is the path to the tls client key. TLSKeyPath string // TLSCertPAth is the path to the client tls certificate. TLSCertPath string // TLSCACertPath is the path to the ca certificate. It will be used to verify whip service // certificates. TLSCACertPath string }
ClientOptions is a set of options used when creating new clients.
type WhipClient ¶
type WhipClient struct {
// contains filtered or unexported fields
}
WhipClient is a client that connects to whip control service to coordinate establishment of reverse tcp tunnels. It first registers itself with the control service using given hostname and domain (its name becomes hostname.domain) then waits for tcp connect control messages (see protos). When it receives one, it establishes a reverse tcp connection to the whip control service and begins proxying it to the local requested port.
func NewWhipClient ¶
func NewWhipClient(whipClientConn *grpc.ClientConn, tcpConnDialer types.ClientConnDialer, hostname, domain string, ports []int) *WhipClient
NewWhipClient creates a new client connecting to whip control service using whipClientConn and dials tcp connections back to whip service using tcpConnDialer. It registers itself with whip control service as hostname and domain (hostname.domain becomes its known name) and publishes ports that can be used for reverse tunnels.
func (*WhipClient) Start ¶
func (c *WhipClient) Start(logger logging.TraceLogger) error
Start starts the whip client. It returns immediately before connection to whip service is established.
func (*WhipClient) Stop ¶
func (c *WhipClient) Stop(logger logging.TraceLogger) error
Stop stops this client instance disconnecting from whip service and disconnecting all currently established reverse tunnels. The function will block until all connections are terminated.