Documentation ¶
Overview ¶
Package dialer implements a gRPC dialer over a tunneled connection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientDialer ¶
type ClientDialer struct {
// contains filtered or unexported fields
}
ClientDialer performs dialing to targets behind a given tunnel connection.
func FromClient ¶
func FromClient(tc *tunnel.Client) (*ClientDialer, error)
FromClient creates a new target dialer with an existing tunnel client connection. Sample code with error handling elided:
conn, err := grpc.DialContext(ctx, tunnelAddress) client := tpb.NewTunnelClient(conn) tc := tunnel.NewClient(client, tunnel.ClientConfig{}, nil) d := dialer.FromClient(tc)
func (*ClientDialer) DialContext ¶
func (d *ClientDialer) DialContext(ctx context.Context, target, targetType string, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error)
DialContext establishes a grpc.Conn to a remote tunnel client via the attached tunnel server and returns an error if the connection is not established.
The dialer can be used to create connections to multiple targets behind the same tunnel server used to instantiate the dialer.
conn, err := d.DialContext(ctx, "target1", "target-type1", opts1) conn, err := d.DialContext(ctx, "target2", "target-type2", opts2)
type ServerDialer ¶
type ServerDialer struct {
// contains filtered or unexported fields
}
ServerDialer performs dialing to collector via a given tunnel connection.
func FromServer ¶
func FromServer(ts *tunnel.Server) (*ServerDialer, error)
FromServer creates a new collector dialer with an existing tunnel server. Sample code with error handling elided:
ts := tunnel.NewServer(tunnel.ServerConfig{}) d := dialer.FromServer(ts)
func (*ServerDialer) DialContext ¶
func (d *ServerDialer) DialContext(ctx context.Context, target string, targetType string, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error)
DialContext establishes a grpc.Conn to the attached tunnel server and returns an error if the connection is not established.