Documentation
¶
Overview ¶
Package advLayer contains subpackages for Advanced Layer in VSI model.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var MaxEarlyDataLen = 2048 //for ws early data
为了避免黑客攻击,我们固定earlydata最大值为2048
View Source
var ProtocolsMap = make(map[string]Creator)
The implementations should use ProtocolsMap to regiester their Creator.
Functions ¶
func PrintAllProtocolNames ¶
func PrintAllProtocolNames()
Types ¶
type Conf ¶
type Conf struct { TlsConf *tls.Config //for quic Host string Addr netLayer.Addr Path string Headers *httpLayer.HeaderPreset IsEarly bool //is 0-rtt or not; for quic and ws. Xver int //for Super, like quic, PROXY protocol Extra map[string]any //quic: useHysteria, hysteria_manual, maxbyte; grpc: multiMode }
type Creator ¶
type Creator interface { ProtocolName() string PackageID() string //unique for each package, sub packages in v2ray_simple don't need to apply prefix, but if you want to implement your own package, you should use full git path, like github.com/somebody/mypackage //NewClientFromURL(url *url.URL) (Client, error) //todo: support url NewClientFromConf(conf *Conf) (Client, error) NewServerFromConf(conf *Conf) (Server, error) GetDefaultAlpn() (alpn string, mustUse bool) CanHandleHeaders() bool //If true, there won't be an extra http header layer during the relay progress, and the matching progress of the customized http headers will be handled inside this package. IsMux() bool // if IsMux, if is Client, then it is a MuxClient, or it's a SingleClient; if is Server, then it is a MuxServer, or it's a SingleServer IsSuper() bool // quic is a super protocol, which handles transport layer dialing and tls layer handshake directly. If IsSuper, then it's a SuperMuxServer }
Creator represents supported features of a advLayer sub-package, and it can create New Client and Server.
type MuxClient ¶
type MuxClient interface { Client // If IsSuper, underlay should be nil; conn must be non nil when err==nil. // // If not IsSuper and underlay == nil, it will return error if it can't find any extablished connection. // Usually underlay is tls.Conn. GetCommonConn(underlay net.Conn) (conn any, err error) //underlay is conn returned from GetCommonConn DialSubConn(underlay any) (net.Conn, error) }
like grpc (h2) and quic (h3)
type MuxServer ¶
type MuxServer interface { //non-blocking. if fallbackChan is not nil, then it can serve for fallback feature. StartHandle(underlay net.Conn, newSubConnChan chan net.Conn, fallbackChan chan httpLayer.FallbackMeta) }
like grpc
type SingleClient ¶
type SingleClient interface { Client //it's 0-rtt if payload is provided Handshake(underlay net.Conn, payload []byte) (net.Conn, error) }
like ws (h1.1)
Directories
¶
Path | Synopsis |
---|---|
Package grpc implements methods for grpc.
|
Package grpc implements methods for grpc. |
Package grpcSimple implements grpc tunnel without importing google.golang.org/grpc.
|
Package grpcSimple implements grpc tunnel without importing google.golang.org/grpc. |
Package quic defines functions to listen and dial quic, with some customizable congestion settings.
|
Package quic defines functions to listen and dial quic, with some customizable congestion settings. |
Package ws implements websocket handshake.
|
Package ws implements websocket handshake. |
Click to show internal directories.
Click to hide internal directories.