transport

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager handles the lifecycle of underlying network connections and seamless switching between them using Yamux session resumption. Uses MTP (Mimic Transport Protocol) over UDP for anti-DPI transport.

func NewManager

func NewManager(serverAddr string, uuid string, dns string) *Manager

NewManager creates a new transport manager

func (*Manager) GetMTPConn

func (m *Manager) GetMTPConn() *mtp.MTPConn

GetMTPConn returns the current MTP connection (for stats)

func (*Manager) RotateTransport

func (m *Manager) RotateTransport(newDomain string) error

RotateTransport switches the underlying transport to a new domain while keeping the Yamux session alive via MTP session migration.

func (*Manager) StartSession

func (m *Manager) StartSession(initialDomain string) (*yamux.Session, error)

StartSession establishes the initial connection and Yamux session over MTP

type VirtualConn

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

VirtualConn is a persistent connection wrapper that can switch its underlying physical connection. This allows upper layers (like Yamux) to think they have a stable connection. It supports buffered seamless swap to prevent data loss during transport rotation.

func NewVirtualConn

func NewVirtualConn(conn net.Conn) *VirtualConn

func (*VirtualConn) Close

func (v *VirtualConn) Close() error

func (*VirtualConn) LocalAddr

func (v *VirtualConn) LocalAddr() net.Addr

func (*VirtualConn) Read

func (v *VirtualConn) Read(b []byte) (n int, err error)

func (*VirtualConn) RemoteAddr

func (v *VirtualConn) RemoteAddr() net.Addr

func (*VirtualConn) SetDeadline

func (v *VirtualConn) SetDeadline(t time.Time) error

func (*VirtualConn) SetReadDeadline

func (v *VirtualConn) SetReadDeadline(t time.Time) error

func (*VirtualConn) SetWriteDeadline

func (v *VirtualConn) SetWriteDeadline(t time.Time) error

func (*VirtualConn) SwapConnection

func (v *VirtualConn) SwapConnection(newConn net.Conn)

SwapConnection replaces the underlying connection with a new one. The old connection is NOT closed here, caller handles it.

func (*VirtualConn) SwapConnectionSeamless

func (v *VirtualConn) SwapConnectionSeamless(newConn net.Conn) error

SwapConnectionSeamless replaces the underlying connection with buffered transition. Writes during the swap are captured and replayed on the new connection.

func (*VirtualConn) Write

func (v *VirtualConn) Write(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

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