Documentation ¶
Overview ¶
Package dnet contains alternative net.Conn implementations.
Index ¶
- func NewK8sPortForwardDialer(logCtx context.Context, kubeFlags *kates.ConfigFlags, ...) (func(context.Context, string) (net.Conn, error), error)
- func NewLoopbackListener() (net.Listener, func(net.Conn) error)
- func WrapAmbassadorCloudTunnelServer(impl systema.SystemAProxy_ReverseConnectionServer, closeFn func()) net.Conn
- type Conn
- func AcceptFromAmbassadorCloud(systema manager.ManagerProxy_HandleConnectionServer, closeFn func()) (interceptID string, conn Conn, err error)
- func DialFromAmbassadorCloud(ctx context.Context, managerClient manager.ManagerProxyClient, ...) (Conn, error)
- func WrapAmbassadorCloudTunnelClient(impl systema.SystemAProxy_ReverseConnectionClient) Conn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewK8sPortForwardDialer ¶
func NewK8sPortForwardDialer(logCtx context.Context, kubeFlags *kates.ConfigFlags, kubeKatesClient *kates.Client) (func(context.Context, string) (net.Conn, error), error)
NewK8sPortForwardDialer returns a dialer function (matching the signature required by grpc.WithContextDialer) that dials to a port on a Kubernetes Pod, in the manor of `kubectl port-forward`. It returns the direct connection to the apiserver; it does not establish a local port being forwarded from or otherwise pump data over the connection.
func NewLoopbackListener ¶ added in v2.3.7
NewLoopbackListener returns a net.Listener that rather than listening on a real network interface, waits for you to add new connections to it with the returned AddConn function.
func WrapAmbassadorCloudTunnelServer ¶ added in v2.4.8
func WrapAmbassadorCloudTunnelServer(impl systema.SystemAProxy_ReverseConnectionServer, closeFn func()) net.Conn
WrapAmbassadorCloudTunnel takes a systema.SystemAProxy_ReverseConnectionServer and wraps it so that it can be used as a net.Conn.
It is important to call `.Close()` when you are done with the connection, in order to release resources associated with it. The GC will not be able to collect it if you do not call `.Close()`.
Types ¶
type Conn ¶
type Conn interface { net.Conn // Wait until either the connection is Close()d, or one of Read() or Write() encounters an // error (*not* counting errors caused by deadlines). If this returns because Close() was // called, nil is returned; otherwise the triggering error is returned. // // Essentially: Wait until the connection is finished. Wait() error }
Conn is a net.Conn, plus a Wait() method.
func AcceptFromAmbassadorCloud ¶
func AcceptFromAmbassadorCloud(systema manager.ManagerProxy_HandleConnectionServer, closeFn func()) (interceptID string, conn Conn, err error)
AcceptFromAmbassadorCloud is used by a Telepresence manger to accept a connection to an intercept for a preview URL from a Ambassador Cloud.
It is the counterpart to DialFromAmbassadorCloud.
func DialFromAmbassadorCloud ¶
func DialFromAmbassadorCloud(ctx context.Context, managerClient manager.ManagerProxyClient, interceptID string, opts ...grpc.CallOption) (Conn, error)
DialFromAmbassadorCloud is used by Ambassador Cloud to dial to the manager, initiating a connection to an intercept for a preview URL.
It is the counterpart to AcceptFromAmbassadorCloud.
func WrapAmbassadorCloudTunnelClient ¶ added in v2.4.8
func WrapAmbassadorCloudTunnelClient(impl systema.SystemAProxy_ReverseConnectionClient) Conn
WrapAmbassadorCloudTunnelClient takes a systema.SystemAProxy_ReverseConnectionClient and wraps it so that it can be used as a net.Conn.
It is important to call `.Close()` when you are done with the connection, in order to release resources associated with it. The GC will not be able to collect it if you do not call `.Close()`.