session

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTP2Session added in v0.5.36

type HTTP2Session struct {
	// contains filtered or unexported fields
}

HTTP2Session extends information about connected client stored in Session. It also includes: - control connection for exchanging communication with the client - channel with available tunnel connections - timestamp with the last known ping from the client

func NewHTTP2Session added in v0.5.36

func NewHTTP2Session(args *HTTP2SessionArgs) (*HTTP2Session, error)

NewHTTP2Session creates new TCPSession struct

func (*HTTP2Session) AddEndpoint added in v0.6.0

func (s *HTTP2Session) AddEndpoint(e net.Addr)

AddEndpoint add an endpoint addr to this session.

func (*HTTP2Session) AddTunnel added in v0.5.36

func (s *HTTP2Session) AddTunnel(conn *tls.Conn) error

AddTunnel adds a connection to the pool of tunnel connections

func (*HTTP2Session) Agent added in v0.5.36

func (s *HTTP2Session) Agent() string

Agent returns the wormhole client information (e.g. version of the binary)

func (*HTTP2Session) BackendID added in v0.5.36

func (s *HTTP2Session) BackendID() string

BackendID returns and ID of the backend that this session belongs to

func (*HTTP2Session) Client added in v0.5.36

func (s *HTTP2Session) Client() string

Client returns the client address (likely IP:PORT) of this session's client

func (*HTTP2Session) ClientCAs added in v0.6.0

func (s *HTTP2Session) ClientCAs() (*x509.CertPool, error)

ClientCAs returns a CertPool for the session that is used for client certificate authentication.

func (*HTTP2Session) ClientIP added in v0.5.36

func (s *HTTP2Session) ClientIP() string

ClientIP returns an IP address of this session's client

func (*HTTP2Session) Close added in v0.5.36

func (s *HTTP2Session) Close()

Close closes SSHSession and registers disconnection

func (*HTTP2Session) Cluster added in v0.5.36

func (s *HTTP2Session) Cluster() string

Cluster returns a cluster identifier

func (*HTTP2Session) Endpoints added in v0.6.0

func (s *HTTP2Session) Endpoints() []net.Addr

Endpoints returns a list of endpoint addresses that have been registered for this session.

func (*HTTP2Session) HandleRequests added in v0.5.36

func (s *HTTP2Session) HandleRequests(ln net.Listener)

HandleRequests handles all requests coming over the control connection from the client. The main function is to accept ingress traffic (from the listener) once the remote port forwarding is set up. It also handles out-of-band communication, like the maintaining the Session heartbeat or request the client to open new tunnel connections.

func (*HTTP2Session) ID added in v0.5.36

func (s *HTTP2Session) ID() string

ID returns ID of this session

func (*HTTP2Session) Key added in v0.5.36

func (s *HTTP2Session) Key() string

Key returns a session key

func (*HTTP2Session) NodeID added in v0.5.36

func (s *HTTP2Session) NodeID() string

NodeID returns an id of the wormhole server on which is session is registered

func (*HTTP2Session) Region added in v0.7.0

func (s *HTTP2Session) Region() string

Region returns a region identifier

func (*HTTP2Session) RegisterEndpoint added in v0.5.36

func (s *HTTP2Session) RegisterEndpoint() error

RegisterEndpoint registers the endpoint and adds it to the current session record The endpoint is a particular instance of a running wormhole client

func (*HTTP2Session) Release added in v0.5.36

func (s *HTTP2Session) Release() *messages.Release

Release returns release information, if one has been received for this session

func (*HTTP2Session) RequireAuthentication added in v0.5.36

func (s *HTTP2Session) RequireAuthentication() error

RequireAuthentication registers the connection TODO: add authentication here

func (*HTTP2Session) RequireStream added in v0.5.36

func (s *HTTP2Session) RequireStream() error

RequireStream sends a request to the client to open a new tunnel Connection for this Session.

func (*HTTP2Session) RequiresClientAuth added in v0.6.0

func (s *HTTP2Session) RequiresClientAuth() bool

RequiresClientAuth returns true if the session requires a client certificate authentication.

func (*HTTP2Session) ServeHTTP added in v0.5.36

func (s *HTTP2Session) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP...

func (*HTTP2Session) ValidCertificate added in v0.6.0

func (s *HTTP2Session) ValidCertificate(c *x509.Certificate) (bool, error)

ValidCertificate returns true if a certificate is in the list of valid certificates.

type HTTP2SessionArgs added in v0.5.36

type HTTP2SessionArgs struct {
	Logger    *logrus.Logger
	NodeID    string
	TLSConfig *tls.Config
	RedisPool *redis.Pool
	Conn      net.Conn
}

HTTP2SessionArgs defines the arguments to be passed to NewHTTP2Session

type RedisStore

type RedisStore struct {
	// contains filtered or unexported fields
}

RedisStore is session persistence using Redis

func NewRedisStore

func NewRedisStore(pool *redis.Pool) *RedisStore

NewRedisStore returns RedisStore struct

func (*RedisStore) Announce added in v0.7.0

func (r *RedisStore) Announce(rep []byte)

Announce announces the server on redis rep is a serialized representation of the current server

func (*RedisStore) BackendIDFromToken

func (r *RedisStore) BackendIDFromToken(token string) (string, error)

BackendIDFromToken returns a backendID for the token or errors out if none found

func (*RedisStore) BackendRequiresClientAuth added in v0.6.0

func (r *RedisStore) BackendRequiresClientAuth(backendID string) (bool, error)

BackendRequiresClientAuth returns a backendID for the token or errors out if none found

func (*RedisStore) GetClientCAs added in v0.6.0

func (r *RedisStore) GetClientCAs(backendID string) ([]byte, error)

GetClientCAs returns full unparsed certificate chain for the client auth for the backend

func (*RedisStore) RegisterConnection

func (r *RedisStore) RegisterConnection(s Session) error

RegisterConnection writes Session connection info in Redis Should be called when a client connects.

func (*RedisStore) RegisterDisconnection

func (r *RedisStore) RegisterDisconnection(s Session) error

RegisterDisconnection removes Session connection info from Redis Should be called when a client disconnects.

func (*RedisStore) RegisterEndpoint

func (r *RedisStore) RegisterEndpoint(s Session) error

RegisterEndpoint updates the client endoint addr in stored session and adds Endpoint to the list of endpoints stored in Redis

func (*RedisStore) RegisterHeartbeat

func (r *RedisStore) RegisterHeartbeat(s Session) error

RegisterHeartbeat updates timestamps for session and endpoint keys

func (*RedisStore) RegisterRelease

func (r *RedisStore) RegisterRelease(s Session) error

RegisterRelease updates VCS (e.g git) info collected by the client

func (*RedisStore) UpdateAttribute

func (r *RedisStore) UpdateAttribute(s Session, name string, value interface{}) error

UpdateAttribute updates a single Session attribute in Redis

func (*RedisStore) ValidCertificate added in v0.6.0

func (r *RedisStore) ValidCertificate(backendID, fingerprint string) (bool, error)

ValidCertificate returns true if a fingerprint is a in the list of valid certificates for the backend.

type Registry added in v0.6.0

type Registry struct {
	// contains filtered or unexported fields
}

Registry holds references to all active sessions

func NewRegistry added in v0.6.0

func NewRegistry(l *logrus.Logger) *Registry

NewRegistry initializes a new Registry struct

func (*Registry) AddSession added in v0.6.0

func (r *Registry) AddSession(s Session)

AddSession adds session to the registry

func (*Registry) Close added in v0.6.0

func (r *Registry) Close()

Close closes and removes all sessions

func (*Registry) GetSession added in v0.6.0

func (r *Registry) GetSession(id string) Session

GetSession returns session stored in the registry, or nil if not found

func (*Registry) RemoveSession added in v0.6.0

func (r *Registry) RemoveSession(s Session)

RemoveSession removes session if currently stored in the registry

type SSHSession

type SSHSession struct {
	// contains filtered or unexported fields
}

SSHSession extends information about connected client stored in Session. It also includes SSH-specific information like the SSH conn, SSH server config, etc.

func NewSSHSession

func NewSSHSession(logger *logrus.Logger, clusterURL, nodeID string, region string, redisPool *redis.Pool, tcpConn net.Conn, config *ssh.ServerConfig) *SSHSession

NewSSHSession creates new SshSession struct

func (*SSHSession) AddEndpoint added in v0.6.0

func (s *SSHSession) AddEndpoint(e net.Addr)

AddEndpoint add an endpoint addr to this session.

func (*SSHSession) Agent

func (s *SSHSession) Agent() string

Agent returns the wormhole client information (e.g. version of the binary)

func (*SSHSession) BackendID

func (s *SSHSession) BackendID() string

BackendID returns and ID of the backend that this session belongs to

func (*SSHSession) Client

func (s *SSHSession) Client() string

Client returns the client address (likely IP:PORT) of this session's client

func (*SSHSession) ClientCAs added in v0.6.0

func (s *SSHSession) ClientCAs() (*x509.CertPool, error)

ClientCAs returns a CertPool for the session that is used for client certificate authentication.

func (*SSHSession) ClientIP

func (s *SSHSession) ClientIP() string

ClientIP returns an IP address of this session's client

func (*SSHSession) Close

func (s *SSHSession) Close()

Close closes SSHSession and registers disconnection

func (*SSHSession) Cluster

func (s *SSHSession) Cluster() string

Cluster returns a cluster identifier

func (*SSHSession) Endpoints added in v0.6.0

func (s *SSHSession) Endpoints() []net.Addr

Endpoints returns a list of endpoint addresses that have been registered for this session.

func (*SSHSession) HandleRequests

func (s *SSHSession) HandleRequests(ln net.Listener)

HandleRequests handles all requests coming over the SSH connection from the client. The main function is to accept ingress traffic (from the listener) once the remote port forwarding is set up. It also handles out-of-band SSH request types, like the keepalive or register-release.

func (*SSHSession) ID

func (s *SSHSession) ID() string

ID returns ID of this session

func (*SSHSession) Key

func (s *SSHSession) Key() string

Key returns a session key

func (*SSHSession) NodeID

func (s *SSHSession) NodeID() string

NodeID returns an id of the wormhole server on which is session is registered

func (*SSHSession) Region added in v0.7.0

func (s *SSHSession) Region() string

Region returns a region identifier

func (*SSHSession) RegisterEndpoint

func (s *SSHSession) RegisterEndpoint() error

RegisterEndpoint registers the endpoint and adds it to the current session record The endpoint is a particular instance of a running wormhole client

func (*SSHSession) Release

func (s *SSHSession) Release() *messages.Release

Release returns release information, if one has been received for this session

func (*SSHSession) RequireAuthentication

func (s *SSHSession) RequireAuthentication() error

RequireAuthentication registers the connection, since authentication is part of the SSH handshake TODO: figure out a better interface for Session

func (*SSHSession) RequireStream

func (s *SSHSession) RequireStream() error

RequireStream performs SSH handshake and ensures SSHSession is ready to receive and send data

func (*SSHSession) RequiresClientAuth added in v0.6.0

func (s *SSHSession) RequiresClientAuth() bool

RequiresClientAuth returns true if the session requires a client certificate authentication.

func (*SSHSession) ValidCertificate added in v0.6.0

func (s *SSHSession) ValidCertificate(c *x509.Certificate) (bool, error)

ValidCertificate returns true if a certificate is in the list of valid certificates.

type Session

type Session interface {
	ID() string
	Agent() string
	BackendID() string
	NodeID() string
	Client() string
	ClientIP() string
	Cluster() string
	Region() string
	Endpoints() []net.Addr
	AddEndpoint(endpoint net.Addr)
	Key() string
	Release() *messages.Release
	RequireStream() error
	RequireAuthentication() error
	RequiresClientAuth() bool
	ClientCAs() (*x509.CertPool, error)
	ValidCertificate(c *x509.Certificate) (bool, error)
	Close()
}

Session hold information about connected client

type Store

type Store interface {
	RegisterConnection(s Session) error
	RegisterDisconnection(s Session) error
	RegisterRelease(s Session) error
	RegisterEndpoint(s Session) error
	RegisterHeartbeat(s Session) error
	UpdateAttribute(s Session, name string, value interface{}) error
	BackendIDFromToken(token string) (string, error)
	BackendRequiresClientAuth(backendID string) (bool, error)
	ValidCertificate(backendID, fingerprint string) (bool, error)
	GetClientCAs(backendID string) ([]byte, error)
	Announce(rep []byte)
}

Store is an interface to session persistence layer, e.g. Redis

type TCPSession

type TCPSession struct {
	// contains filtered or unexported fields
}

TCPSession extends information about connected client stored in Session. It also includes: - control connection for exchanging communication with the client - channel with available tunnel connections - timestamp with the last known ping from the client

func NewTCPSession

func NewTCPSession(logger *logrus.Logger, nodeID string, redisPool *redis.Pool, conn net.Conn) *TCPSession

NewTCPSession creates new TCPSession struct

func (*TCPSession) AddEndpoint added in v0.6.0

func (s *TCPSession) AddEndpoint(e net.Addr)

AddEndpoint add an endpoint addr to this session.

func (*TCPSession) AddTunnel

func (s *TCPSession) AddTunnel(conn net.Conn)

AddTunnel adds a connection to the pool of tunnel connections

func (*TCPSession) Agent

func (s *TCPSession) Agent() string

Agent returns the wormhole client information (e.g. version of the binary)

func (*TCPSession) BackendID

func (s *TCPSession) BackendID() string

BackendID returns and ID of the backend that this session belongs to

func (*TCPSession) Client

func (s *TCPSession) Client() string

Client returns the client address (likely IP:PORT) of this session's client

func (*TCPSession) ClientCAs added in v0.6.0

func (s *TCPSession) ClientCAs() (*x509.CertPool, error)

ClientCAs returns a CertPool for the session that is used for client certificate authentication.

func (*TCPSession) ClientIP

func (s *TCPSession) ClientIP() string

ClientIP returns an IP address of this session's client

func (*TCPSession) Close

func (s *TCPSession) Close()

Close closes SSHSession and registers disconnection

func (*TCPSession) Cluster

func (s *TCPSession) Cluster() string

Cluster returns a cluster identifier

func (*TCPSession) Endpoints added in v0.6.0

func (s *TCPSession) Endpoints() []net.Addr

Endpoints returns a list of endpoint addresses that have been registered for this session.

func (*TCPSession) GetTunnel

func (s *TCPSession) GetTunnel() (conn net.Conn, err error)

GetTunnel gets a new tunnel connection from the pool of available connections. If no connections are available it will request a new tunnel connection from the client and it will block until tunnelTimeoutInterval.

func (*TCPSession) HandleRequests

func (s *TCPSession) HandleRequests(ln net.Listener)

HandleRequests handles all requests coming over the control connection from the client. The main function is to accept ingress traffic (from the listener) once the remote port forwarding is set up. It also handles out-of-band communication, like the maintaining the Session heartbeat or request the client to open new tunnel connections.

func (*TCPSession) ID

func (s *TCPSession) ID() string

ID returns ID of this session

func (*TCPSession) Key

func (s *TCPSession) Key() string

Key returns a session key

func (*TCPSession) NodeID

func (s *TCPSession) NodeID() string

NodeID returns an id of the wormhole server on which is session is registered

func (*TCPSession) Region added in v0.7.0

func (s *TCPSession) Region() string

Region returns a region identifier

func (*TCPSession) RegisterEndpoint

func (s *TCPSession) RegisterEndpoint() error

RegisterEndpoint registers the endpoint and adds it to the current session record The endpoint is a particular instance of a running wormhole client

func (*TCPSession) Release

func (s *TCPSession) Release() *messages.Release

Release returns release information, if one has been received for this session

func (*TCPSession) RequireAuthentication

func (s *TCPSession) RequireAuthentication() error

RequireAuthentication registers the connection TODO: add authentication here

func (*TCPSession) RequireStream

func (s *TCPSession) RequireStream() error

RequireStream sends a request to the client to open a new tunnel Connection for this Session.

func (*TCPSession) RequiresClientAuth added in v0.6.0

func (s *TCPSession) RequiresClientAuth() bool

RequiresClientAuth returns true if the session requires a client certificate authentication.

func (*TCPSession) ValidCertificate added in v0.6.0

func (s *TCPSession) ValidCertificate(c *x509.Certificate) (bool, error)

ValidCertificate returns true if a certificate is in the list of valid certificates.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL