Documentation ¶
Overview ¶
Package quic defines functions to listen and dial quic, with some customizable congestion settings.
我们这里暂时使用 quic-go包。注意该包是不完美的,对阻塞控制支持不好,而且cpu占用率高。以后有更好的包的话要及时切换到好包。
这里我们 还选择性 使用 hysteria的 brutal阻控. 见 https://github.com/tobyxdd/quic-go 中 toby的 *-mod 分支, 里面会多一个 congestion 文件夹.
Index ¶
- Constants
- Variables
- func CloseConn(conn any)
- func ListenInitialLayers(addr string, tlsConf tls.Config, arg arguments) (newConnChan chan net.Conn, returnCloser io.Closer)
- type BrutalSender
- func (b *BrutalSender) CanSend(bytesInFlight congestion.ByteCount) bool
- func (b *BrutalSender) GetCongestionWindow() congestion.ByteCount
- func (b *BrutalSender) HasPacingBudget() bool
- func (b *BrutalSender) InRecovery() bool
- func (b *BrutalSender) InSlowStart() bool
- func (b *BrutalSender) MaybeExitSlowStart()
- func (b *BrutalSender) OnPacketAcked(number congestion.PacketNumber, ackedBytes congestion.ByteCount, ...)
- func (b *BrutalSender) OnPacketLost(number congestion.PacketNumber, lostBytes congestion.ByteCount, ...)
- func (b *BrutalSender) OnPacketSent(sentTime time.Time, bytesInFlight congestion.ByteCount, ...)
- func (b *BrutalSender) OnRetransmissionTimeout(packetsRetransmitted bool)
- func (b *BrutalSender) SetMaxDatagramSize(size congestion.ByteCount)
- func (b *BrutalSender) SetRTTStatsProvider(rttStats congestion.RTTStatsProvider)
- func (b *BrutalSender) TimeUntilSend(bytesInFlight congestion.ByteCount) time.Time
- type BrutalSender_M
- func (b *BrutalSender_M) CanSend(bytesInFlight congestion.ByteCount) bool
- func (b *BrutalSender_M) GetCongestionWindow() congestion.ByteCount
- func (b *BrutalSender_M) HasPacingBudget() bool
- func (b *BrutalSender_M) InRecovery() bool
- func (b *BrutalSender_M) InSlowStart() bool
- func (b *BrutalSender_M) MaybeExitSlowStart()
- func (b *BrutalSender_M) OnPacketAcked(number congestion.PacketNumber, ackedBytes congestion.ByteCount, ...)
- func (b *BrutalSender_M) OnPacketLost(number congestion.PacketNumber, lostBytes congestion.ByteCount, ...)
- func (b *BrutalSender_M) OnPacketSent(sentTime time.Time, bytesInFlight congestion.ByteCount, ...)
- func (b *BrutalSender_M) OnRetransmissionTimeout(packetsRetransmitted bool)
- func (b *BrutalSender_M) SetMaxDatagramSize(size congestion.ByteCount)
- func (b *BrutalSender_M) SetRTTStatsProvider(rttStats congestion.RTTStatsProvider)
- func (b *BrutalSender_M) TimeUntilSend(bytesInFlight congestion.ByteCount) time.Time
- type Client
- type Creator
- type Server
- type StreamConn
Constants ¶
View Source
const (
//100mbps
Default_hysteriaMaxByteCount = 1024 * 1024 / 8 * 100
)
Variables ¶
View Source
var ( //h3 DefaultAlpnList = []string{"h3"} )
View Source
var TheCustomRate = 0.75
Functions ¶
Types ¶
type BrutalSender ¶
type BrutalSender struct {
// contains filtered or unexported fields
}
func NewBrutalSender ¶
func NewBrutalSender(bps congestion.ByteCount) *BrutalSender
func (*BrutalSender) CanSend ¶
func (b *BrutalSender) CanSend(bytesInFlight congestion.ByteCount) bool
func (*BrutalSender) GetCongestionWindow ¶
func (b *BrutalSender) GetCongestionWindow() congestion.ByteCount
func (*BrutalSender) HasPacingBudget ¶
func (b *BrutalSender) HasPacingBudget() bool
func (*BrutalSender) InRecovery ¶
func (b *BrutalSender) InRecovery() bool
func (*BrutalSender) InSlowStart ¶
func (b *BrutalSender) InSlowStart() bool
func (*BrutalSender) MaybeExitSlowStart ¶
func (b *BrutalSender) MaybeExitSlowStart()
func (*BrutalSender) OnPacketAcked ¶
func (b *BrutalSender) OnPacketAcked(number congestion.PacketNumber, ackedBytes congestion.ByteCount, priorInFlight congestion.ByteCount, eventTime time.Time)
func (*BrutalSender) OnPacketLost ¶
func (b *BrutalSender) OnPacketLost(number congestion.PacketNumber, lostBytes congestion.ByteCount, priorInFlight congestion.ByteCount)
func (*BrutalSender) OnPacketSent ¶
func (b *BrutalSender) OnPacketSent(sentTime time.Time, bytesInFlight congestion.ByteCount, packetNumber congestion.PacketNumber, bytes congestion.ByteCount, isRetransmittable bool)
func (*BrutalSender) OnRetransmissionTimeout ¶
func (b *BrutalSender) OnRetransmissionTimeout(packetsRetransmitted bool)
func (*BrutalSender) SetMaxDatagramSize ¶
func (b *BrutalSender) SetMaxDatagramSize(size congestion.ByteCount)
func (*BrutalSender) SetRTTStatsProvider ¶
func (b *BrutalSender) SetRTTStatsProvider(rttStats congestion.RTTStatsProvider)
func (*BrutalSender) TimeUntilSend ¶
func (b *BrutalSender) TimeUntilSend(bytesInFlight congestion.ByteCount) time.Time
type BrutalSender_M ¶
type BrutalSender_M struct {
// contains filtered or unexported fields
}
func NewBrutalSender_M ¶
func NewBrutalSender_M(bps congestion.ByteCount) *BrutalSender_M
func (*BrutalSender_M) CanSend ¶
func (b *BrutalSender_M) CanSend(bytesInFlight congestion.ByteCount) bool
func (*BrutalSender_M) GetCongestionWindow ¶
func (b *BrutalSender_M) GetCongestionWindow() congestion.ByteCount
func (*BrutalSender_M) HasPacingBudget ¶
func (b *BrutalSender_M) HasPacingBudget() bool
func (*BrutalSender_M) InRecovery ¶
func (b *BrutalSender_M) InRecovery() bool
func (*BrutalSender_M) InSlowStart ¶
func (b *BrutalSender_M) InSlowStart() bool
func (*BrutalSender_M) MaybeExitSlowStart ¶
func (b *BrutalSender_M) MaybeExitSlowStart()
func (*BrutalSender_M) OnPacketAcked ¶
func (b *BrutalSender_M) OnPacketAcked(number congestion.PacketNumber, ackedBytes congestion.ByteCount, priorInFlight congestion.ByteCount, eventTime time.Time)
func (*BrutalSender_M) OnPacketLost ¶
func (b *BrutalSender_M) OnPacketLost(number congestion.PacketNumber, lostBytes congestion.ByteCount, priorInFlight congestion.ByteCount)
func (*BrutalSender_M) OnPacketSent ¶
func (b *BrutalSender_M) OnPacketSent(sentTime time.Time, bytesInFlight congestion.ByteCount, packetNumber congestion.PacketNumber, bytes congestion.ByteCount, isRetransmittable bool)
func (*BrutalSender_M) OnRetransmissionTimeout ¶
func (b *BrutalSender_M) OnRetransmissionTimeout(packetsRetransmitted bool)
func (*BrutalSender_M) SetMaxDatagramSize ¶
func (b *BrutalSender_M) SetMaxDatagramSize(size congestion.ByteCount)
func (*BrutalSender_M) SetRTTStatsProvider ¶
func (b *BrutalSender_M) SetRTTStatsProvider(rttStats congestion.RTTStatsProvider)
func (*BrutalSender_M) TimeUntilSend ¶
func (b *BrutalSender_M) TimeUntilSend(bytesInFlight congestion.ByteCount) time.Time
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
implements advLayer.MuxClient
func (*Client) GetCommonConn ¶
获取已拨号的连接,或者重新从底层拨号。返回一个可作 c.DialSubConn 参数 的值.
type Creator ¶
type Creator struct{}
func (Creator) GetDefaultAlpn ¶
func (Creator) NewClientFromConf ¶
func (Creator) NewServerFromConf ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) StartHandle ¶
func (s *Server) StartHandle(underlay net.Conn, newSubConnChan chan net.Conn, fallbackConnChan chan advLayer.FallbackMeta)
非阻塞,不支持回落。
func (*Server) StartListen ¶
type StreamConn ¶
type StreamConn struct { quic.Stream // contains filtered or unexported fields }
implements net.Conn.
func (*StreamConn) Close ¶
func (sc *StreamConn) Close() error
func (*StreamConn) LocalAddr ¶
func (sc *StreamConn) LocalAddr() net.Addr
func (*StreamConn) RemoteAddr ¶
func (sc *StreamConn) RemoteAddr() net.Addr
Click to show internal directories.
Click to hide internal directories.