You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

66 lines
1.5 KiB

package core
import (
"net"
"time"
"maze.io/gate/pkg/core/logger"
"maze.io/gate/pkg/util/compact"
)
type Service interface {
// Component returns the name of the service component.
Component() string
// Setup the service.
Setup(provider IdentityProvider) error
// Start the service.
Start(*logger.Logger, chan<- error) error
// Close the service.
Close() error
// Transports returns a slice of connected transports.
Transports() []Transport
}
// TODO(maze): there are no interfaces yet for the following:
// - transports (for example an SSH client connection)
// - sessions (for example an SSH client session)
// - conns (for example a tunneled SSH connection)
// Transport is an authenticated channel used for carrying
type Transport interface {
// TransportID is the globally unique identifier.
TransportID() compact.ID
// User is the authenticated user on this transport.
User() User
// Close terminates the transport.
Close() error
// LocalAddr returns the local network address.
LocalAddr() net.Addr
// RemoteAddr returns the remote network address.
RemoteAddr() net.Addr
// ConnectedAt returns the connection time.
ConnectedAt() time.Time
// Tunnels are the tunnels initiated from this transport.
Tunnels() []Tunnel
}
// Tunnel is a TCP tunnel.
type Tunnel interface {
net.Conn
// User is the authenticated user on this transport.
User() User
// ConnectedAt returns the connection time.
ConnectedAt() time.Time
}