tuic

package
v1.1.13 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: MPL-2.0, MPL-2.0 Imports: 23 Imported by: 0

README

TUIC transport compatibility

service.go, packet.go, protocol.go, and hub.go are derived from wyx2685/Xray-core commit 83ad74c463351e01c7cde391abfd9dded9e78300, under MPL-2.0. The original source is at: https://github.com/wyx2685/Xray-core/tree/83ad74c463351e01c7cde391abfd9dded9e78300/transport/internet/tuic

The upstream listener checks authReady() and then queues work separately. Authentication can drain the queue between those operations, leaving the first TCP stream or UDP datagram waiting forever. Queued unidirectional UDP streams also return through defer stream.CancelRead(0) before being consumed.

This copy replaces that queue with waits on authDone in the existing stream and datagram goroutines. Waiting also observes the connection context so shutdown and peer disconnects release pending operations. It keeps upstream's proxy, authenticator, settings, packet interfaces, and congestion control.

The listener is registered as ppnode-tuic; the inbound builder selects it after building the normal TUIC configuration. No global Go module cache is modified. Remove this compatibility module and the builder remapping once the pinned upstream version fixes these races and the TCP/UDP regression tests pass.

Documentation

Index

Constants

View Source
const (
	TUICVersion byte = tuicVersion

	TUICCommandAuthenticate byte = commandAuthenticate
	TUICCommandConnect      byte = commandConnect
	TUICCommandPacket       byte = commandPacket
	TUICCommandDissociate   byte = commandDissociate
	TUICCommandHeartbeat    byte = commandHeartbeat
)
View Source
const ProtocolName = "ppnode-tuic"

ProtocolName distinguishes the repaired listener from the upstream listener. Authentication and packet interfaces remain those of the upstream TUIC proxy.

Variables

This section is empty.

Functions

func Listen

func Listen(ctx context.Context, address xnet.Address, port xnet.Port, streamSettings *internet.MemoryStreamConfig, handler internet.ConnHandler) (internet.Listener, error)

func ReadDestination

func ReadDestination(reader io.Reader, network xnet.Network) (xnet.Destination, error)

Types

type Listener

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

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

func (*Listener) Close

func (l *Listener) Close() error

type PacketConn

type PacketConn interface {
	stdnet.Conn
	ReadPacket() ([]byte, xnet.Destination, error)
	WritePacket([]byte, xnet.Destination) error
}

Jump to

Keyboard shortcuts

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