Documentation ¶
Index ¶
- Constants
- func AccessControlEntriesToVisibility(accessControlEntries []tunnels.TunnelAccessControlEntry) string
- func IsInternalPort(port *tunnels.TunnelPort) bool
- type CodespacesPortForwarder
- func (fwd *CodespacesPortForwarder) Close() error
- func (fwd *CodespacesPortForwarder) ConnectToForwardedPort(ctx context.Context, conn io.ReadWriteCloser, opts ForwardPortOpts) error
- func (fwd *CodespacesPortForwarder) ForwardPort(ctx context.Context, opts ForwardPortOpts) error
- func (fwd *CodespacesPortForwarder) ForwardPortToListener(ctx context.Context, opts ForwardPortOpts, listener *net.TCPListener) error
- func (fwd *CodespacesPortForwarder) GetKeepAliveReason() string
- func (fwd *CodespacesPortForwarder) KeepAlive(reason string)
- func (fwd *CodespacesPortForwarder) ListPorts(ctx context.Context) (ports []*tunnels.TunnelPort, err error)
- func (fwd *CodespacesPortForwarder) UpdatePortVisibility(ctx context.Context, remotePort int, visibility string) error
- type ForwardPortOpts
- type PortForwarder
Constants ¶
const ( InternalPortTag = "InternalPort" UserForwardedPortTag = "UserForwardedPort" )
const ( PrivatePortVisibility = "private" OrgPortVisibility = "org" PublicPortVisibility = "public" )
Variables ¶
This section is empty.
Functions ¶
func AccessControlEntriesToVisibility ¶
func AccessControlEntriesToVisibility(accessControlEntries []tunnels.TunnelAccessControlEntry) string
AccessControlEntriesToVisibility converts the access control entries used by Dev Tunnels to a friendly visibility value.
func IsInternalPort ¶
func IsInternalPort(port *tunnels.TunnelPort) bool
IsInternalPort returns true if the port is internal.
Types ¶
type CodespacesPortForwarder ¶ added in v2.37.0
type CodespacesPortForwarder struct {
// contains filtered or unexported fields
}
func (*CodespacesPortForwarder) Close ¶ added in v2.39.0
func (fwd *CodespacesPortForwarder) Close() error
Close closes the port forwarder's tunnel client connection.
func (*CodespacesPortForwarder) ConnectToForwardedPort ¶ added in v2.37.0
func (fwd *CodespacesPortForwarder) ConnectToForwardedPort(ctx context.Context, conn io.ReadWriteCloser, opts ForwardPortOpts) error
ConnectToForwardedPort connects to the forwarded port via a given ReadWriteCloser. Optionally, it detects traffic over the connection and sends activity signals to the server to keep the codespace from shutting down.
func (*CodespacesPortForwarder) ForwardPort ¶ added in v2.37.0
func (fwd *CodespacesPortForwarder) ForwardPort(ctx context.Context, opts ForwardPortOpts) error
ForwardPort informs the host that we would like to forward the given port.
func (*CodespacesPortForwarder) ForwardPortToListener ¶ added in v2.37.0
func (fwd *CodespacesPortForwarder) ForwardPortToListener(ctx context.Context, opts ForwardPortOpts, listener *net.TCPListener) error
ForwardPortToListener forwards the specified port to the given TCP listener.
func (*CodespacesPortForwarder) GetKeepAliveReason ¶ added in v2.37.0
func (fwd *CodespacesPortForwarder) GetKeepAliveReason() string
GetKeepAliveReason fetches the keep alive reason from the channel and returns it.
func (*CodespacesPortForwarder) KeepAlive ¶ added in v2.37.0
func (fwd *CodespacesPortForwarder) KeepAlive(reason string)
KeepAlive accepts a reason that is retained if there is no active reason to send to the server.
func (*CodespacesPortForwarder) ListPorts ¶ added in v2.37.0
func (fwd *CodespacesPortForwarder) ListPorts(ctx context.Context) (ports []*tunnels.TunnelPort, err error)
ListPorts fetches the list of ports that are currently forwarded.
func (*CodespacesPortForwarder) UpdatePortVisibility ¶ added in v2.37.0
func (fwd *CodespacesPortForwarder) UpdatePortVisibility(ctx context.Context, remotePort int, visibility string) error
UpdatePortVisibility changes the visibility (private, org, public) of the specified port.
type ForwardPortOpts ¶ added in v2.37.0
type PortForwarder ¶
type PortForwarder interface { ForwardPortToListener(ctx context.Context, opts ForwardPortOpts, listener *net.TCPListener) error ForwardPort(ctx context.Context, opts ForwardPortOpts) error ConnectToForwardedPort(ctx context.Context, conn io.ReadWriteCloser, opts ForwardPortOpts) error ListPorts(ctx context.Context) ([]*tunnels.TunnelPort, error) UpdatePortVisibility(ctx context.Context, remotePort int, visibility string) error KeepAlive(reason string) GetKeepAliveReason() string Close() error }
func NewPortForwarder ¶
func NewPortForwarder(ctx context.Context, codespaceConnection *connection.CodespaceConnection) (fwd PortForwarder, err error)
NewPortForwarder returns a new PortForwarder for the specified codespace.