datagramsession

package
v0.0.0-...-f274180 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewManager

func NewManager(log *zerolog.Logger, sendF transportSender, receiveChan <-chan *packet.Session) *manager

func SessionIdleErr

func SessionIdleErr(timeout time.Duration) error

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

type Session struct {
	ID uuid.UUID
	// contains filtered or unexported fields
}

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 cloudflared using the transportSender callback. - Manager receives datagrams from receiveChan and calls the transportToDst method of the Session to send to the eyeball

func (*Session) Serve

func (s *Session) Serve(ctx context.Context, closeAfterIdle time.Duration) (closedByRemote bool, err error)

Jump to

Keyboard shortcuts

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