Documentation
¶
Overview ¶
Package forwarding provides forwarding infrastructure.
Index ¶
- Variables
- type Configuration
- func (*Configuration) Descriptor() ([]byte, []int)
- func (c *Configuration) EnsureValid(endpointSpecific bool) error
- func (m *Configuration) GetSocketGroup() string
- func (m *Configuration) GetSocketOverwriteMode() SocketOverwriteMode
- func (m *Configuration) GetSocketOwner() string
- func (m *Configuration) GetSocketPermissionMode() uint32
- func (*Configuration) ProtoMessage()
- func (m *Configuration) Reset()
- func (m *Configuration) String() string
- func (m *Configuration) XXX_DiscardUnknown()
- func (m *Configuration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Configuration) XXX_Merge(src proto.Message)
- func (m *Configuration) XXX_Size() int
- func (m *Configuration) XXX_Unmarshal(b []byte) error
- type Endpoint
- type Manager
- func (m *Manager) Create(source, destination *url.URL, ...) (string, error)
- func (m *Manager) List(selection *selection.Selection, previousStateIndex uint64) (uint64, []*State, error)
- func (m *Manager) Pause(selection *selection.Selection, prompter string) error
- func (m *Manager) Resume(selection *selection.Selection, prompter string) error
- func (m *Manager) Shutdown()
- func (m *Manager) Terminate(selection *selection.Selection, prompter string) error
- type ProtocolHandler
- type Session
- func (*Session) Descriptor() ([]byte, []int)
- func (s *Session) EnsureValid() error
- func (m *Session) GetConfiguration() *Configuration
- func (m *Session) GetConfigurationDestination() *Configuration
- func (m *Session) GetConfigurationSource() *Configuration
- func (m *Session) GetCreatingVersionMajor() uint32
- func (m *Session) GetCreatingVersionMinor() uint32
- func (m *Session) GetCreatingVersionPatch() uint32
- func (m *Session) GetCreationTime() *timestamp.Timestamp
- func (m *Session) GetDestination() *url.URL
- func (m *Session) GetIdentifier() string
- func (m *Session) GetLabels() map[string]string
- func (m *Session) GetName() string
- func (m *Session) GetPaused() bool
- func (m *Session) GetSource() *url.URL
- func (m *Session) GetVersion() Version
- func (*Session) ProtoMessage()
- func (m *Session) Reset()
- func (m *Session) String() string
- func (m *Session) XXX_DiscardUnknown()
- func (m *Session) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Session) XXX_Merge(src proto.Message)
- func (m *Session) XXX_Size() int
- func (m *Session) XXX_Unmarshal(b []byte) error
- type SocketOverwriteMode
- func (m SocketOverwriteMode) Description() string
- func (SocketOverwriteMode) EnumDescriptor() ([]byte, []int)
- func (m SocketOverwriteMode) IsDefault() bool
- func (x SocketOverwriteMode) String() string
- func (m SocketOverwriteMode) Supported() bool
- func (m *SocketOverwriteMode) UnmarshalText(textBytes []byte) error
- type State
- func (s *State) Copy() *State
- func (*State) Descriptor() ([]byte, []int)
- func (s *State) EnsureValid() error
- func (m *State) GetDestinationConnected() bool
- func (m *State) GetLastError() string
- func (m *State) GetOpenConnections() uint64
- func (m *State) GetSession() *Session
- func (m *State) GetSourceConnected() bool
- func (m *State) GetStatus() Status
- func (m *State) GetTotalConnections() uint64
- func (*State) ProtoMessage()
- func (m *State) Reset()
- func (m *State) String() string
- func (m *State) XXX_DiscardUnknown()
- func (m *State) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *State) XXX_Merge(src proto.Message)
- func (m *State) XXX_Size() int
- func (m *State) XXX_Unmarshal(b []byte) error
- type Status
- type Version
- func (v Version) DefaultSocketGroupSpecification() string
- func (v Version) DefaultSocketOverwriteMode() SocketOverwriteMode
- func (v Version) DefaultSocketOwnerSpecification() string
- func (v Version) DefaultSocketPermissionMode() filesystem.Mode
- func (Version) EnumDescriptor() ([]byte, []int)
- func (x Version) String() string
- func (v Version) Supported() bool
Constants ¶
This section is empty.
Variables ¶
var ProtocolHandlers = map[urlpkg.Protocol]ProtocolHandler{}
ProtocolHandlers is a map of registered protocol handlers. It should only be modified during init() operations.
var SocketOverwriteMode_name = map[int32]string{
0: "SocketOverwriteModeDefault",
1: "SocketOverwriteModeLeave",
2: "SocketOverwriteModeOverwrite",
}
var SocketOverwriteMode_value = map[string]int32{
"SocketOverwriteModeDefault": 0,
"SocketOverwriteModeLeave": 1,
"SocketOverwriteModeOverwrite": 2,
}
var Status_name = map[int32]string{
0: "Disconnected",
1: "ConnectingSource",
2: "ConnectingDestination",
3: "ForwardingConnections",
}
var Status_value = map[string]int32{
"Disconnected": 0,
"ConnectingSource": 1,
"ConnectingDestination": 2,
"ForwardingConnections": 3,
}
var Version_name = map[int32]string{
0: "Invalid",
1: "Version1",
}
var Version_value = map[string]int32{
"Invalid": 0,
"Version1": 1,
}
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct { // SocketOverwriteMode specifies whether or not existing Unix domain sockets // should be overwritten when creating new listener sockets. SocketOverwriteMode SocketOverwriteMode `` /* 129-byte string literal not displayed */ // SocketOwner specifies the owner identifier to use for Unix domain // listener sockets. SocketOwner string `protobuf:"bytes,42,opt,name=socketOwner,proto3" json:"socketOwner,omitempty"` // SocketGroup specifies the group identifier to use for Unix domain // listener sockets. SocketGroup string `protobuf:"bytes,43,opt,name=socketGroup,proto3" json:"socketGroup,omitempty"` // SocketPermissionMode specifies the permission mode to use for Unix domain // listener sockets. SocketPermissionMode uint32 `protobuf:"varint,44,opt,name=socketPermissionMode,proto3" json:"socketPermissionMode,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Configuration encodes session configuration parameters. It is used for create commands to specify configuration options, for loading global configuration options, and for storing a merged configuration inside sessions.
func MergeConfigurations ¶
func MergeConfigurations(lower, higher *Configuration) *Configuration
MergeConfigurations merges two configurations of differing priorities. Both configurations must be non-nil.
func (*Configuration) Descriptor ¶
func (*Configuration) Descriptor() ([]byte, []int)
func (*Configuration) EnsureValid ¶
func (c *Configuration) EnsureValid(endpointSpecific bool) error
EnsureValid ensures that Configuration's invariants are respected. The validation of the configuration depends on whether or not it is endpoint-specific.
func (*Configuration) GetSocketGroup ¶
func (m *Configuration) GetSocketGroup() string
func (*Configuration) GetSocketOverwriteMode ¶
func (m *Configuration) GetSocketOverwriteMode() SocketOverwriteMode
func (*Configuration) GetSocketOwner ¶
func (m *Configuration) GetSocketOwner() string
func (*Configuration) GetSocketPermissionMode ¶
func (m *Configuration) GetSocketPermissionMode() uint32
func (*Configuration) ProtoMessage ¶
func (*Configuration) ProtoMessage()
func (*Configuration) Reset ¶
func (m *Configuration) Reset()
func (*Configuration) String ¶
func (m *Configuration) String() string
func (*Configuration) XXX_DiscardUnknown ¶
func (m *Configuration) XXX_DiscardUnknown()
func (*Configuration) XXX_Marshal ¶
func (m *Configuration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*Configuration) XXX_Merge ¶
func (m *Configuration) XXX_Merge(src proto.Message)
func (*Configuration) XXX_Size ¶
func (m *Configuration) XXX_Size() int
func (*Configuration) XXX_Unmarshal ¶
func (m *Configuration) XXX_Unmarshal(b []byte) error
type Endpoint ¶
type Endpoint interface { // Open should open a net connection for the endpoint. For listener (source) // endpoints, this function should block until an incoming connection // arrives. For dialer (destination) endpoints, this function should dial // the underlying target. Open() (net.Conn, error) // Shutdown shuts down the endpoint. This function should unblock any // pending Open call. Shutdown() error }
Endpoint is a generic network connectivity interface that can represent both listening or dialing. In general, it is not safe for concurrent calls. It is, however, required that Shutdown be callable concurrently with other methods.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides forwarding session 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( source, destination *url.URL, configuration, configurationSource, configurationDestination *Configuration, name string, labels map[string]string, paused bool, prompter string, ) (string, error)
Create tells the manager to create a new session.
func (*Manager) List ¶
func (m *Manager) List(selection *selection.Selection, previousStateIndex uint64) (uint64, []*State, error)
List requests a state snapshot for the specified sessions.
func (*Manager) Pause ¶
Pause tells the manager to pause sessions matching the given specifications.
func (*Manager) Resume ¶
Resume tells the manager to resume sessions matching the given specifications.
type ProtocolHandler ¶
type ProtocolHandler interface { // Connect connects to an endpoint using the connection parameters in the // provided URL and the specified prompter (if any). It then initializes the // endpoint using the specified parameters. Connect( logger *logging.Logger, url *urlpkg.URL, prompter string, session string, version Version, configuration *Configuration, source bool, ) (Endpoint, error) }
ProtocolHandler defines the interface that protocol handlers must support in order to connect to endpoints.
type Session ¶
type Session struct { // Identifier is the (unique) session identifier. It is static. It cannot be // empty. Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` // Version is the session version. It is static. Version Version `protobuf:"varint,2,opt,name=version,proto3,enum=forwarding.Version" json:"version,omitempty"` // CreationTime is the creation time of the session. 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 session. 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 session. 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 session. It is static. CreatingVersionPatch uint32 `protobuf:"varint,6,opt,name=creatingVersionPatch,proto3" json:"creatingVersionPatch,omitempty"` // Source is the source endpoint URL. It is static. It cannot be nil. Source *url.URL `protobuf:"bytes,7,opt,name=source,proto3" json:"source,omitempty"` // Destination is the destination endpoint URL. It is static. It cannot be // nil. Destination *url.URL `protobuf:"bytes,8,opt,name=destination,proto3" json:"destination,omitempty"` // Configuration is the flattened session configuration. It is static. It // cannot be nil. Configuration *Configuration `protobuf:"bytes,9,opt,name=configuration,proto3" json:"configuration,omitempty"` // ConfigurationSource are the source-specific session configuration // overrides. It is static. ConfigurationSource *Configuration `protobuf:"bytes,10,opt,name=configurationSource,proto3" json:"configurationSource,omitempty"` // ConfigurationDestination are the destination-specific session // configuration overrides. It is static. ConfigurationDestination *Configuration `protobuf:"bytes,11,opt,name=configurationDestination,proto3" json:"configurationDestination,omitempty"` // Name is a user-friendly name for the session. It may be empty and is not // guaranteed to be unique across all sessions. It is only used as a simpler // handle for specifying sessions. It is static. Name string `protobuf:"bytes,12,opt,name=name,proto3" json:"name,omitempty"` // Labels are the session labels. They are static. Labels map[string]string `` /* 154-byte string literal not displayed */ // Paused indicates whether or not the session is marked as paused. Paused bool `protobuf:"varint,14,opt,name=paused,proto3" json:"paused,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Session) Descriptor ¶
func (*Session) EnsureValid ¶
EnsureValid ensures that Session's invariants are respected.
func (*Session) GetConfiguration ¶
func (m *Session) GetConfiguration() *Configuration
func (*Session) GetConfigurationDestination ¶
func (m *Session) GetConfigurationDestination() *Configuration
func (*Session) GetConfigurationSource ¶
func (m *Session) GetConfigurationSource() *Configuration
func (*Session) GetCreatingVersionMajor ¶
func (*Session) GetCreatingVersionMinor ¶
func (*Session) GetCreatingVersionPatch ¶
func (*Session) GetCreationTime ¶
func (*Session) GetDestination ¶
func (*Session) GetIdentifier ¶
func (*Session) GetVersion ¶
func (*Session) ProtoMessage ¶
func (*Session) ProtoMessage()
func (*Session) XXX_DiscardUnknown ¶
func (m *Session) XXX_DiscardUnknown()
func (*Session) XXX_Marshal ¶
func (*Session) XXX_Unmarshal ¶
type SocketOverwriteMode ¶
type SocketOverwriteMode int32
SocketOverwriteMode specifies the behavior for overwriting (removing) existing Unix domain sockets.
const ( // SocketOverwriteMode_SocketOverwriteModeDefault represents an unspecified // socket overwrite mode. It should be converted to one of the following // values based on the desired default behavior. SocketOverwriteMode_SocketOverwriteModeDefault SocketOverwriteMode = 0 // SocketOverwriteMode_SocketOverwriteModeLeave specifies that existing // sockets should not be overwritten when creating a Unix domain socket // listener. SocketOverwriteMode_SocketOverwriteModeLeave SocketOverwriteMode = 1 // SocketOverwriteMode_SocketOverwriteModeOverwrite specifies that existing // sockets should be overwritten when creating a Unix domain socket // listener. SocketOverwriteMode_SocketOverwriteModeOverwrite SocketOverwriteMode = 2 )
func (SocketOverwriteMode) Description ¶
func (m SocketOverwriteMode) Description() string
Description returns a human-readable description of a staging mode.
func (SocketOverwriteMode) EnumDescriptor ¶
func (SocketOverwriteMode) EnumDescriptor() ([]byte, []int)
func (SocketOverwriteMode) IsDefault ¶
func (m SocketOverwriteMode) IsDefault() bool
IsDefault indicates whether or not the staging mode is SocketOverwriteMode_SocketOverwriteModeDefault.
func (SocketOverwriteMode) String ¶
func (x SocketOverwriteMode) String() string
func (SocketOverwriteMode) Supported ¶
func (m SocketOverwriteMode) Supported() bool
Supported indicates whether or not a particular socket overwrite mode is a valid, non-default value.
func (*SocketOverwriteMode) UnmarshalText ¶
func (m *SocketOverwriteMode) UnmarshalText(textBytes []byte) error
UnmarshalText implements the text unmarshalling interface used when loading from TOML files.
type State ¶
type State struct { // Session is the session specification. Session *Session `protobuf:"bytes,1,opt,name=session,proto3" json:"session,omitempty"` // Status is the status of the session. Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=forwarding.Status" json:"status,omitempty"` // SourceConnected indicates whether or not the source endpoint is // connected. SourceConnected bool `protobuf:"varint,3,opt,name=sourceConnected,proto3" json:"sourceConnected,omitempty"` // DestinationConnected indicates whether or not the destination endpoint is // connected. DestinationConnected bool `protobuf:"varint,4,opt,name=destinationConnected,proto3" json:"destinationConnected,omitempty"` // LastError indicates the last error that occurred during forwarding. LastError string `protobuf:"bytes,5,opt,name=lastError,proto3" json:"lastError,omitempty"` // OpenConnections is the number of connections currently open and being // forwarded. OpenConnections uint64 `protobuf:"varint,6,opt,name=openConnections,proto3" json:"openConnections,omitempty"` // TotalConnections is the number of total connections that have been opened // and forwarded (including those that are currently open). TotalConnections uint64 `protobuf:"varint,7,opt,name=totalConnections,proto3" json:"totalConnections,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
State encodes the state of a forwarding session.
func (*State) Copy ¶
Copy creates a copy of the state, deep-copying those members which are mutable.
func (*State) Descriptor ¶
func (*State) EnsureValid ¶
EnsureValid ensures that State's invariants are respected.
func (*State) GetDestinationConnected ¶
func (*State) GetLastError ¶
func (*State) GetOpenConnections ¶
func (*State) GetSession ¶
func (*State) GetSourceConnected ¶
func (*State) GetTotalConnections ¶
func (*State) ProtoMessage ¶
func (*State) ProtoMessage()
func (*State) XXX_DiscardUnknown ¶
func (m *State) XXX_DiscardUnknown()
func (*State) XXX_Marshal ¶
func (*State) XXX_Unmarshal ¶
type Status ¶
type Status int32
Status encodes the status of a forwarding session.
const ( // Status_Disconnected indicates that the session is disconnected. Status_Disconnected Status = 0 // Status_ConnectingSource indicates that the session is in the process of // connecting to the source endpoint. Status_ConnectingSource Status = 1 // Status_ConnectingDestination indicates that the session is in the process // of connecting to the destination endpoint. Status_ConnectingDestination Status = 2 // Status_ForwardingConnections indicates that the session is connected and // currently forwarding connections. Status_ForwardingConnections Status = 3 )
func (Status) Description ¶
Description returns a human-readable description of the session status.
func (Status) EnumDescriptor ¶
type Version ¶
type Version int32
Version specifies a session version, providing default behavior that can vary without affecting existing sessions.
func (Version) DefaultSocketGroupSpecification ¶
DefaultSocketGroupSpecification returns the default socket group specification for the session version.
func (Version) DefaultSocketOverwriteMode ¶
func (v Version) DefaultSocketOverwriteMode() SocketOverwriteMode
DefaultSocketOverwriteMode returns the default socket overwrite mode for the session version.
func (Version) DefaultSocketOwnerSpecification ¶
DefaultSocketOwnerSpecification returns the default socket owner specification for the session version.
func (Version) DefaultSocketPermissionMode ¶
func (v Version) DefaultSocketPermissionMode() filesystem.Mode
DefaultSocketPermissionMode returns the default socket permission mode for the session version.
func (Version) EnumDescriptor ¶
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package endpoint provides forwarding endpoint implementations.
|
Package endpoint provides forwarding endpoint implementations. |
local
Package local provides a local forwarding endpoint implementation.
|
Package local provides a local forwarding endpoint implementation. |
remote
Package remote provides a client/server architecture for connecting to and hosting a remote forwarding endpoint.
|
Package remote provides a client/server architecture for connecting to and hosting a remote forwarding endpoint. |
Package protocols provides forwarding session protocol handler implementations.
|
Package protocols provides forwarding session protocol handler implementations. |
docker
Package docker provides the Docker forwarding session protocol implementation.
|
Package docker provides the Docker forwarding session protocol implementation. |
local
Package local provides the local forwarding session protocol implementation.
|
Package local provides the local forwarding session protocol implementation. |
ssh
Package ssh provides the SSH forwarding session protocol implementation.
|
Package ssh provides the SSH forwarding session protocol implementation. |
tunnel
Package tunnel provides a tunnel-based forwarding protocol implementation.
|
Package tunnel provides a tunnel-based forwarding protocol implementation. |