relay

package
v0.0.0-...-915d5cb Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	ID         string
	AuthkeyB64 string
	Cipher     crypto.SymmetricCipher

	// Lock when reading or writing
	Conn             net.Conn
	LastNormalActive time.Time
	ConnectTime      time.Time
	// Lock immediately after locking, set to false after unlocking
	Relaying bool
	Mu       sync.Mutex
}

func (*Connection) SendMsgDetectAlive

func (c *Connection) SendMsgDetectAlive() (alive bool)

Be careful of deadlocks

type ConnectionStatus

type ConnectionStatus struct {
	ID          string
	ReqAddr     string
	ConnectTime time.Time
	LastActive  time.Time
	Relaying    bool
}

type Relay

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

func NewRelay

func NewRelay(config config.Config, storage storage.Storage) *Relay

func (*Relay) AddConnection

func (r *Relay) AddConnection(id string, conn net.Conn, authKey tool.AES192Key, cipher crypto.SymmetricCipher)

func (*Relay) GetAllStatus

func (r *Relay) GetAllStatus() []ConnectionStatus

func (*Relay) GetConnectionStatus

func (r *Relay) GetConnectionStatus(id string) (ConnectionStatus, bool)

func (*Relay) RemoveLongConnection

func (r *Relay) RemoveLongConnection(id string)

func (*Relay) Run

func (r *Relay) Run()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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