mux

package
v0.34.8 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: GPL-3.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

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
}

FlushWriter batches small writes to conn. The first write error is sticky: every later Write, Flush and Close returns it, so frames are never silently dropped after the underlying connection has failed.

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) CloseReason added in v0.34.8

func (s *Mux) CloseReason() string

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