Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
LogFieldSessionID = "sessionID"
)
Functions ¶
func FormatSessionID ¶
func NewManager ¶
func SessionIdleErr ¶
Types ¶
type ErrVithVariableSeverity ¶
type ErrVithVariableSeverity interface { error // LogLevel return the severity of this error LogLevel() zerolog.Level }
ErrVithVariableSeverity are errors that have variable severity
type Manager ¶
type Manager interface { // Serve starts the event loop Serve(ctx context.Context) error // RegisterSession starts tracking a session. Caller is responsible for starting the session RegisterSession(ctx context.Context, sessionID uuid.UUID, dstConn io.ReadWriteCloser) (*Session, error) // UnregisterSession stops tracking the session and terminates it UnregisterSession(ctx context.Context, sessionID uuid.UUID, message string, byRemote bool) error // UpdateLogger updates the logger used by the Manager UpdateLogger(log *zerolog.Logger) }
Manager defines the APIs to manage sessions from the same transport.
type Session ¶
Session is a bidirectional pipe of datagrams between transport and dstConn Destination can be a connection with origin or with eyeball When the destination is origin: - Manager receives datagrams from receiveChan and calls the transportToDst method of the Session to send to origin - Datagrams from origin are read from conn and Send to transport using the transportSender callback. Transport will return them to eyeball When the destination is eyeball: - Datagrams from eyeball are read from conn and Send to transport. Transport will send them to tunnellink using the transportSender callback. - Manager receives datagrams from receiveChan and calls the transportToDst method of the Session to send to the eyeball