mux

package
v0.34.2 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PingInterval = 5 * time.Second
	PingJitter   = 2 * time.Second
	PingMaxPad   = 16
)

Functions

func Ips

func Ips() (map[string]string, error)

Types

type Bandwidth

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

func NewBandwidth

func NewBandwidth(fd *os.File) *Bandwidth

func (*Bandwidth) Close

func (Self *Bandwidth) Close() error

func (*Bandwidth) Get

func (Self *Bandwidth) Get() (bw float64)

func (*Bandwidth) SetCopySize

func (Self *Bandwidth) SetCopySize(n uint16)

func (*Bandwidth) StartRead

func (Self *Bandwidth) StartRead()

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewConn

func NewConn(connId int32, mux *Mux) *Conn

func (*Conn) Close

func (s *Conn) Close() (err error)

func (*Conn) IsClosed

func (s *Conn) IsClosed() bool

func (*Conn) LocalAddr

func (s *Conn) LocalAddr() net.Addr

func (*Conn) Read

func (s *Conn) Read(buf []byte) (n int, err error)

func (*Conn) RemoteAddr

func (s *Conn) RemoteAddr() net.Addr

func (*Conn) SetClosingFlag

func (s *Conn) SetClosingFlag()

func (*Conn) SetDeadline

func (s *Conn) SetDeadline(t time.Time) error

func (*Conn) SetPriority added in v0.30.6

func (s *Conn) SetPriority()

func (*Conn) SetReadDeadline

func (s *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetWriteDeadline

func (s *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) Write

func (s *Conn) Write(buf []byte) (n int, err error)

type ConnMap

type ConnMap struct {

	//closeCh chan struct{}
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewConnMap

func NewConnMap() *ConnMap

func (*ConnMap) Close

func (s *ConnMap) Close()

func (*ConnMap) Delete

func (s *ConnMap) Delete(id int32)

func (*ConnMap) Get

func (s *ConnMap) Get(id int32) (*Conn, bool)

func (*ConnMap) Set

func (s *ConnMap) Set(id int32, v *Conn)

func (*ConnMap) Size

func (s *ConnMap) Size() (n int)

type Eth

type Eth struct {
	EthName string
	EthAddr string
}

func GetEthByIp

func GetEthByIp(ipAddr string) (eth *Eth, err error)

GetEthByIp get ip and Eth information by Eth name

type FlushWriter

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

func NewFlushWriter

func NewFlushWriter(conn net.Conn) *FlushWriter

func (*FlushWriter) Close

func (w *FlushWriter) Close() error

func (*FlushWriter) Flush

func (w *FlushWriter) Flush() error

func (*FlushWriter) Write

func (w *FlushWriter) Write(p []byte) (n int, err error)

type Mux

type Mux struct {
	net.Listener
	// contains filtered or unexported fields
}

func NewMux

func NewMux(c net.Conn, connType string, pingCheckThreshold int, isInitiator bool) *Mux

func (*Mux) Accept

func (s *Mux) Accept() (net.Conn, error)

func (*Mux) Addr

func (s *Mux) Addr() net.Addr

func (*Mux) Close

func (s *Mux) Close() (err error)

func (*Mux) IsClosed

func (s *Mux) IsClosed() bool

func (*Mux) NewConn

func (s *Mux) NewConn() (*Conn, error)

type Rate

type Rate struct {
	NowRate int64
	// contains filtered or unexported fields
}

func NewRate

func NewRate(addSize int64) *Rate

func (*Rate) Get

func (s *Rate) Get(size int64)

func (*Rate) ReturnBucket

func (s *Rate) ReturnBucket(size int64)

func (*Rate) Start

func (s *Rate) Start()

func (*Rate) Stop

func (s *Rate) Stop()

type RateConn

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

func NewRateConn

func NewRateConn(rate *Rate, conn net.Conn) *RateConn

func (*RateConn) Close

func (conn *RateConn) Close() error

func (*RateConn) LocalAddr

func (conn *RateConn) LocalAddr() net.Addr

func (*RateConn) Read

func (conn *RateConn) Read(b []byte) (n int, err error)

func (*RateConn) RemoteAddr

func (conn *RateConn) RemoteAddr() net.Addr

func (*RateConn) SetDeadline

func (conn *RateConn) SetDeadline(t time.Time) error

func (*RateConn) SetReadDeadline

func (conn *RateConn) SetReadDeadline(t time.Time) error

func (*RateConn) SetWriteDeadline

func (conn *RateConn) SetWriteDeadline(t time.Time) error

func (*RateConn) Write

func (conn *RateConn) Write(b []byte) (n int, err error)

type TrafficControl

type TrafficControl struct {
	Eth *Eth
	// contains filtered or unexported fields
}

func NewTrafficControl

func NewTrafficControl(ipAddr string) (*TrafficControl, error)

func (*TrafficControl) Run

func (tc *TrafficControl) Run() error

func (*TrafficControl) RunNetRangeTest

func (tc *TrafficControl) RunNetRangeTest(f func()) error

RunNetRangeTest test the network randomly

Jump to

Keyboard shortcuts

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