Documentation
¶
Overview ¶
Package tunnel provides tunnel infrastructure.
Index ¶
- Constants
- Variables
- type Configuration
- type ErrorSeverity
- type InitializeRequestVersion1
- func (*InitializeRequestVersion1) Descriptor() ([]byte, []int)deprecated
- func (x *InitializeRequestVersion1) GetMode() string
- func (x *InitializeRequestVersion1) GetVersionMajor() uint32
- func (x *InitializeRequestVersion1) GetVersionMinor() uint32
- func (x *InitializeRequestVersion1) GetVersionPatch() uint32
- func (*InitializeRequestVersion1) ProtoMessage()
- func (x *InitializeRequestVersion1) ProtoReflect() protoreflect.Message
- func (x *InitializeRequestVersion1) Reset()
- func (x *InitializeRequestVersion1) String() string
- type InitializeResponseVersion1
- func (*InitializeResponseVersion1) Descriptor() ([]byte, []int)deprecated
- func (x *InitializeResponseVersion1) GetError() string
- func (*InitializeResponseVersion1) ProtoMessage()
- func (x *InitializeResponseVersion1) ProtoReflect() protoreflect.Message
- func (x *InitializeResponseVersion1) Reset()
- func (x *InitializeResponseVersion1) String() string
- type Manager
- func (m *Manager) Create(ctx context.Context, configuration *Configuration, name string, ...) (*TunnelHostCredentials, error)
- func (m *Manager) Dial(ctx context.Context, identifierOrName string, mode string, prompter string) (net.Conn, error)
- func (m *Manager) List(_ context.Context, selection *selection.Selection, previousStateIndex uint64) (uint64, []*State, error)
- func (m *Manager) Pause(ctx context.Context, selection *selection.Selection, prompter string) error
- func (m *Manager) Resume(ctx context.Context, selection *selection.Selection, prompter string) error
- func (m *Manager) Shutdown()
- func (m *Manager) Terminate(ctx context.Context, selection *selection.Selection, prompter string) error
- type State
- func (s *State) Copy() *State
- func (*State) Descriptor() ([]byte, []int)deprecated
- func (s *State) EnsureValid() error
- func (x *State) GetActiveSessions() uint64
- func (x *State) GetLastError() string
- func (x *State) GetStatus() Status
- func (x *State) GetTotalSessions() uint64
- func (x *State) GetTunnel() *Tunnel
- func (*State) ProtoMessage()
- func (x *State) ProtoReflect() protoreflect.Message
- func (x *State) Reset()
- func (x *State) String() string
- type Status
- func (s Status) Description() string
- func (Status) Descriptor() protoreflect.EnumDescriptor
- func (x Status) Enum() *Status
- func (Status) EnumDescriptor() ([]byte, []int)deprecated
- func (x Status) Number() protoreflect.EnumNumber
- func (x Status) String() string
- func (Status) Type() protoreflect.EnumType
- type Tunnel
- func (*Tunnel) Descriptor() ([]byte, []int)deprecated
- func (t *Tunnel) EnsureValid() error
- func (x *Tunnel) GetConfiguration() *Configuration
- func (x *Tunnel) GetCreatingVersionMajor() uint32
- func (x *Tunnel) GetCreatingVersionMinor() uint32
- func (x *Tunnel) GetCreatingVersionPatch() uint32
- func (x *Tunnel) GetCreationTime() *timestamp.Timestamp
- func (x *Tunnel) GetIdentifier() string
- func (x *Tunnel) GetLabels() map[string]string
- func (x *Tunnel) GetName() string
- func (x *Tunnel) GetPaused() bool
- func (x *Tunnel) GetSecret() []byte
- func (x *Tunnel) GetToken() string
- func (x *Tunnel) GetVersion() Version
- func (*Tunnel) ProtoMessage()
- func (x *Tunnel) ProtoReflect() protoreflect.Message
- func (x *Tunnel) Reset()
- func (x *Tunnel) String() string
- type TunnelHostCredentials
- func (*TunnelHostCredentials) Descriptor() ([]byte, []int)deprecated
- func (c *TunnelHostCredentials) EnsureValid() error
- func (x *TunnelHostCredentials) GetConfiguration() *Configuration
- func (x *TunnelHostCredentials) GetCreatingVersionMajor() uint32
- func (x *TunnelHostCredentials) GetCreatingVersionMinor() uint32
- func (x *TunnelHostCredentials) GetCreatingVersionPatch() uint32
- func (x *TunnelHostCredentials) GetCreationTime() *timestamp.Timestamp
- func (x *TunnelHostCredentials) GetIdentifier() string
- func (x *TunnelHostCredentials) GetSecret() []byte
- func (x *TunnelHostCredentials) GetToken() string
- func (x *TunnelHostCredentials) GetVersion() Version
- func (*TunnelHostCredentials) ProtoMessage()
- func (x *TunnelHostCredentials) ProtoReflect() protoreflect.Message
- func (x *TunnelHostCredentials) Reset()
- func (x *TunnelHostCredentials) String() string
- type Version
- func (Version) Descriptor() protoreflect.EnumDescriptor
- func (x Version) Enum() *Version
- func (Version) EnumDescriptor() ([]byte, []int)deprecated
- func (x Version) Number() protoreflect.EnumNumber
- func (x Version) String() string
- func (v Version) Supported() bool
- func (Version) Type() protoreflect.EnumType
Constants ¶
const ( // HostTunnelRetryDelayTime is the amount of time to wait before retrying a // HostTunnel call after experiencing a failure with // ErrorSeverityDelayedRecoverable. HostTunnelRetryDelayTime = 5 * time.Second )
Variables ¶
var ( Status_name = map[int32]string{ 0: "Disconnected", 1: "HaltedOnUnrecoverableError", 2: "Connecting", 3: "Connected", } Status_value = map[string]int32{ "Disconnected": 0, "HaltedOnUnrecoverableError": 1, "Connecting": 2, "Connected": 3, } )
Enum value maps for Status.
var ( Version_name = map[int32]string{ 0: "Invalid", 1: "Version1", } Version_value = map[string]int32{ "Invalid": 0, "Version1": 1, } )
Enum value maps for Version.
var File_tunneling_configuration_proto protoreflect.FileDescriptor
var File_tunneling_protocol_proto protoreflect.FileDescriptor
var File_tunneling_state_proto protoreflect.FileDescriptor
var File_tunneling_tunnel_proto protoreflect.FileDescriptor
var File_tunneling_version_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct {
// contains filtered or unexported fields
}
Configuration encodes tunnel configuration parameters.
func (*Configuration) Descriptor
deprecated
func (*Configuration) Descriptor() ([]byte, []int)
Deprecated: Use Configuration.ProtoReflect.Descriptor instead.
func (*Configuration) EnsureValid ¶
func (c *Configuration) EnsureValid() error
EnsureValid ensures that Configuration's invariants are respected.
func (*Configuration) ProtoMessage ¶
func (*Configuration) ProtoMessage()
func (*Configuration) ProtoReflect ¶
func (x *Configuration) ProtoReflect() protoreflect.Message
func (*Configuration) Reset ¶
func (x *Configuration) Reset()
func (*Configuration) String ¶
func (x *Configuration) String() string
type ErrorSeverity ¶
type ErrorSeverity uint8
ErrorServerity indicates the severity of an error.
const ( // ErrorSeverityRecoverable indicates that an operation can recover from the // associated error and should be retried immediately. ErrorSeverityRecoverable ErrorSeverity = iota // ErrorSeverityDelayedRecoverable indicates that an operation can recover // from the associated error, but should only be retried after some period // of time. ErrorSeverityDelayedRecoverable // ErrorSeverityUnrecoverable indicates that an operation cannot recover // from the associated error. ErrorSeverityUnrecoverable )
func HostTunnel ¶
func HostTunnel( ctx context.Context, logger *logging.Logger, hostCredentials *TunnelHostCredentials, ) (ErrorSeverity, error)
HostTunnel performs tunnel hosting with the specified host parameters. It should be called in a loop to facilitate reconnection on failure. In addition to returning an error, it also returns a boolean indicating whether or not that failure is unrecoverable. If the error is unrecoverable, the hosting loop should be terminated.
type InitializeRequestVersion1 ¶
type InitializeRequestVersion1 struct { // VersionMajor is the major version component of the tunnel client. VersionMajor uint32 `protobuf:"varint,1,opt,name=versionMajor,proto3" json:"versionMajor,omitempty"` // VersionMinor is the minor version component of the tunnel client. VersionMinor uint32 `protobuf:"varint,2,opt,name=versionMinor,proto3" json:"versionMinor,omitempty"` // VersionPatch is the patch version component of the tunnel client. VersionPatch uint32 `protobuf:"varint,3,opt,name=versionPatch,proto3" json:"versionPatch,omitempty"` // Mode is the mode in which the agent should be run. Mode string `protobuf:"bytes,4,opt,name=mode,proto3" json:"mode,omitempty"` // contains filtered or unexported fields }
InitializeRequestVersion1 is the data channel initialization request format for tunnels with version Version_Version1.
func (*InitializeRequestVersion1) Descriptor
deprecated
func (*InitializeRequestVersion1) Descriptor() ([]byte, []int)
Deprecated: Use InitializeRequestVersion1.ProtoReflect.Descriptor instead.
func (*InitializeRequestVersion1) GetMode ¶
func (x *InitializeRequestVersion1) GetMode() string
func (*InitializeRequestVersion1) GetVersionMajor ¶
func (x *InitializeRequestVersion1) GetVersionMajor() uint32
func (*InitializeRequestVersion1) GetVersionMinor ¶
func (x *InitializeRequestVersion1) GetVersionMinor() uint32
func (*InitializeRequestVersion1) GetVersionPatch ¶
func (x *InitializeRequestVersion1) GetVersionPatch() uint32
func (*InitializeRequestVersion1) ProtoMessage ¶
func (*InitializeRequestVersion1) ProtoMessage()
func (*InitializeRequestVersion1) ProtoReflect ¶
func (x *InitializeRequestVersion1) ProtoReflect() protoreflect.Message
func (*InitializeRequestVersion1) Reset ¶
func (x *InitializeRequestVersion1) Reset()
func (*InitializeRequestVersion1) String ¶
func (x *InitializeRequestVersion1) String() string
type InitializeResponseVersion1 ¶
type InitializeResponseVersion1 struct { // Error is any error that occurred during initialization. An empty error // indicates that initialization was successful and that the connection is // ready for use by an endpoint client. Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` // contains filtered or unexported fields }
InitializeResponseVersion1 is the data channel initialization response format for tunnels with version Version_Version1.
func (*InitializeResponseVersion1) Descriptor
deprecated
func (*InitializeResponseVersion1) Descriptor() ([]byte, []int)
Deprecated: Use InitializeResponseVersion1.ProtoReflect.Descriptor instead.
func (*InitializeResponseVersion1) GetError ¶
func (x *InitializeResponseVersion1) GetError() string
func (*InitializeResponseVersion1) ProtoMessage ¶
func (*InitializeResponseVersion1) ProtoMessage()
func (*InitializeResponseVersion1) ProtoReflect ¶
func (x *InitializeResponseVersion1) ProtoReflect() protoreflect.Message
func (*InitializeResponseVersion1) Reset ¶
func (x *InitializeResponseVersion1) Reset()
func (*InitializeResponseVersion1) String ¶
func (x *InitializeResponseVersion1) String() string
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides forwarding tunnel management facilities. Its methods are safe for concurrent usage, so it can be easily exported via an RPC interface.
func NewManager ¶
NewManager creates a new Manager instance.
func (*Manager) Create ¶
func (m *Manager) Create( ctx context.Context, configuration *Configuration, name string, labels map[string]string, paused bool, prompter string, ) (*TunnelHostCredentials, error)
Create tells the manager to create a new tunnel.
func (*Manager) Dial ¶
func (m *Manager) Dial( ctx context.Context, identifierOrName string, mode string, prompter string, ) (net.Conn, error)
Dial performs a dial operation on the tunnel specified by identifierOrName. This dial invokes an agent binary in the specified mode with a version compatible with the current Mutagen version.
func (*Manager) List ¶
func (m *Manager) List(_ context.Context, selection *selection.Selection, previousStateIndex uint64) (uint64, []*State, error)
List requests a state snapshot for the specified tunnels.
func (*Manager) Resume ¶
func (m *Manager) Resume(ctx context.Context, selection *selection.Selection, prompter string) error
Resume tells the manager to resume tunnels matching the given specifications.
type State ¶
type State struct { // Tunnel is the tunnel client specification. Tunnel *Tunnel `protobuf:"bytes,1,opt,name=tunnel,proto3" json:"tunnel,omitempty"` // Status is the status of the tunnel. Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=tunneling.Status" json:"status,omitempty"` // LastError indicates the last error that occurred while connecting. LastError string `protobuf:"bytes,3,opt,name=lastError,proto3" json:"lastError,omitempty"` // ActiveSessions is the number of sessions currently operating via the // tunnel. ActiveSessions uint64 `protobuf:"varint,4,opt,name=activeSessions,proto3" json:"activeSessions,omitempty"` // TotalSessions is the number of total sessions that have operated via the // tunnel (including those that are currently operating). TotalSessions uint64 `protobuf:"varint,5,opt,name=totalSessions,proto3" json:"totalSessions,omitempty"` // contains filtered or unexported fields }
State encodes the state of a tunnel.
func (*State) Copy ¶
Copy creates a copy of the state, deep-copying those members which are mutable. It also masks any sensitive members (e.g. API tokens and signing keys) from the copied tunnel object.
func (*State) Descriptor
deprecated
func (*State) EnsureValid ¶
EnsureValid ensures that State's invariants are respected.
func (*State) GetActiveSessions ¶
func (*State) GetLastError ¶
func (*State) GetTotalSessions ¶
func (*State) ProtoMessage ¶
func (*State) ProtoMessage()
func (*State) ProtoReflect ¶
func (x *State) ProtoReflect() protoreflect.Message
type Status ¶
type Status int32
Status encodes the status of a tunnel.
const ( // Status_Disconnected indicates that the tunnel is disconnected. Status_Disconnected Status = 0 // Status_HaltedOnUnrecoverableError indicates that the tunnel has halted // due to an unrecoverable error. Status_HaltedOnUnrecoverableError Status = 1 // Status_Connecting indicates that the tunnel is in the process of // connecting. Status_Connecting Status = 2 // Status_Connected indicates that the tunnel is connected. Status_Connected Status = 3 )
func (Status) Description ¶
Description returns a human-readable description of the tunnel status.
func (Status) Descriptor ¶
func (Status) Descriptor() protoreflect.EnumDescriptor
func (Status) EnumDescriptor
deprecated
func (Status) Number ¶
func (x Status) Number() protoreflect.EnumNumber
func (Status) Type ¶
func (Status) Type() protoreflect.EnumType
type Tunnel ¶
type Tunnel struct { // Identifier is the (unique) tunnel identifier. It is static. It cannot be // empty. Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` // Version is the tunnel version. It is static. Version Version `protobuf:"varint,2,opt,name=version,proto3,enum=tunneling.Version" json:"version,omitempty"` // CreationTime is the creation time of the tunnel. It is static. It cannot // be nil. CreationTime *timestamp.Timestamp `protobuf:"bytes,3,opt,name=creationTime,proto3" json:"creationTime,omitempty"` // CreatingVersionMajor is the major version component of the version of // Mutagen which created the tunnel. It is static. CreatingVersionMajor uint32 `protobuf:"varint,4,opt,name=creatingVersionMajor,proto3" json:"creatingVersionMajor,omitempty"` // CreatingVersionMinor is the minor version component of the version of // Mutagen which created the tunnel. It is static. CreatingVersionMinor uint32 `protobuf:"varint,5,opt,name=creatingVersionMinor,proto3" json:"creatingVersionMinor,omitempty"` // CreatingVersionPatch is the patch version component of the version of // Mutagen which created the tunnel. It is static. CreatingVersionPatch uint32 `protobuf:"varint,6,opt,name=creatingVersionPatch,proto3" json:"creatingVersionPatch,omitempty"` // Token is the API access token for the tunnel endpoint. It is static. Token string `protobuf:"bytes,7,opt,name=token,proto3" json:"token,omitempty"` // Secret is the HMAC secret key used for signing and validating offers. It // is static. Secret []byte `protobuf:"bytes,8,opt,name=secret,proto3" json:"secret,omitempty"` // Configuration is the flattened tunnel configuration. It must not be nil. // It is static. Configuration *Configuration `protobuf:"bytes,9,opt,name=configuration,proto3" json:"configuration,omitempty"` // Name is a user-friendly name for the tunnel. It may be empty and but is // guaranteed to be unique across all tunnels if non-empty. It is only used // as a simpler handle for specifying tunnels. It is static. Name string `protobuf:"bytes,10,opt,name=name,proto3" json:"name,omitempty"` // Labels are the tunnel labels. They are static. Labels map[string]string `` /* 154-byte string literal not displayed */ // Paused indicates whether or not the tunnel is marked as paused. Paused bool `protobuf:"varint,12,opt,name=paused,proto3" json:"paused,omitempty"` // contains filtered or unexported fields }
Tunnel represents a tunnel client configuration.
func (*Tunnel) Descriptor
deprecated
func (*Tunnel) EnsureValid ¶
EnsureValid ensures that Tunnel's invariants are respected.
func (*Tunnel) GetConfiguration ¶
func (x *Tunnel) GetConfiguration() *Configuration
func (*Tunnel) GetCreatingVersionMajor ¶
func (*Tunnel) GetCreatingVersionMinor ¶
func (*Tunnel) GetCreatingVersionPatch ¶
func (*Tunnel) GetCreationTime ¶
func (*Tunnel) GetIdentifier ¶
func (*Tunnel) GetVersion ¶
func (*Tunnel) ProtoMessage ¶
func (*Tunnel) ProtoMessage()
func (*Tunnel) ProtoReflect ¶
func (x *Tunnel) ProtoReflect() protoreflect.Message
type TunnelHostCredentials ¶
type TunnelHostCredentials struct { // Identifier is the (unique) tunnel identifier. It is static. It cannot be // empty. Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` // Version is the tunnel version. It is static. Version Version `protobuf:"varint,2,opt,name=version,proto3,enum=tunneling.Version" json:"version,omitempty"` // CreationTime is the creation time of the tunnel. It is static. It cannot // be nil. CreationTime *timestamp.Timestamp `protobuf:"bytes,3,opt,name=creationTime,proto3" json:"creationTime,omitempty"` // CreatingVersionMajor is the major version component of the version of // Mutagen which created the tunnel. It is static. CreatingVersionMajor uint32 `protobuf:"varint,4,opt,name=creatingVersionMajor,proto3" json:"creatingVersionMajor,omitempty"` // CreatingVersionMinor is the minor version component of the version of // Mutagen which created the tunnel. It is static. CreatingVersionMinor uint32 `protobuf:"varint,5,opt,name=creatingVersionMinor,proto3" json:"creatingVersionMinor,omitempty"` // CreatingVersionPatch is the patch version component of the version of // Mutagen which created the tunnel. It is static. CreatingVersionPatch uint32 `protobuf:"varint,6,opt,name=creatingVersionPatch,proto3" json:"creatingVersionPatch,omitempty"` // Token is the API access token for the tunnel endpoint. It is static. Token string `protobuf:"bytes,7,opt,name=token,proto3" json:"token,omitempty"` // Secret is the HMAC secret key used for signing and validating offers. It // is static. Secret []byte `protobuf:"bytes,8,opt,name=secret,proto3" json:"secret,omitempty"` // Configuration is the flattened tunnel configuration. It must not be nil. // It is static. Configuration *Configuration `protobuf:"bytes,9,opt,name=configuration,proto3" json:"configuration,omitempty"` // contains filtered or unexported fields }
TunnelHostCredentials is the format for the tunnel host credentials file.
func (*TunnelHostCredentials) Descriptor
deprecated
func (*TunnelHostCredentials) Descriptor() ([]byte, []int)
Deprecated: Use TunnelHostCredentials.ProtoReflect.Descriptor instead.
func (*TunnelHostCredentials) EnsureValid ¶
func (c *TunnelHostCredentials) EnsureValid() error
EnsureValid ensures that TunnelHostCredentials' invariants are respected.
func (*TunnelHostCredentials) GetConfiguration ¶
func (x *TunnelHostCredentials) GetConfiguration() *Configuration
func (*TunnelHostCredentials) GetCreatingVersionMajor ¶
func (x *TunnelHostCredentials) GetCreatingVersionMajor() uint32
func (*TunnelHostCredentials) GetCreatingVersionMinor ¶
func (x *TunnelHostCredentials) GetCreatingVersionMinor() uint32
func (*TunnelHostCredentials) GetCreatingVersionPatch ¶
func (x *TunnelHostCredentials) GetCreatingVersionPatch() uint32
func (*TunnelHostCredentials) GetCreationTime ¶
func (x *TunnelHostCredentials) GetCreationTime() *timestamp.Timestamp
func (*TunnelHostCredentials) GetIdentifier ¶
func (x *TunnelHostCredentials) GetIdentifier() string
func (*TunnelHostCredentials) GetSecret ¶
func (x *TunnelHostCredentials) GetSecret() []byte
func (*TunnelHostCredentials) GetToken ¶
func (x *TunnelHostCredentials) GetToken() string
func (*TunnelHostCredentials) GetVersion ¶
func (x *TunnelHostCredentials) GetVersion() Version
func (*TunnelHostCredentials) ProtoMessage ¶
func (*TunnelHostCredentials) ProtoMessage()
func (*TunnelHostCredentials) ProtoReflect ¶
func (x *TunnelHostCredentials) ProtoReflect() protoreflect.Message
func (*TunnelHostCredentials) Reset ¶
func (x *TunnelHostCredentials) Reset()
func (*TunnelHostCredentials) String ¶
func (x *TunnelHostCredentials) String() string
type Version ¶
type Version int32
Version specifies a tunnel version, providing default behavior that can vary without affecting existing tunnels.
func (Version) Descriptor ¶
func (Version) Descriptor() protoreflect.EnumDescriptor
func (Version) EnumDescriptor
deprecated
func (Version) Number ¶
func (x Version) Number() protoreflect.EnumNumber
func (Version) Type ¶
func (Version) Type() protoreflect.EnumType
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package webrtcutil provides utilities to complement github.com/pion/webrtc.
|
Package webrtcutil provides utilities to complement github.com/pion/webrtc. |