advLayer

package
v1.1.9-beta.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: MIT Imports: 7 Imported by: 0

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)

Functions

func PrintAllProtocolNames

func PrintAllProtocolNames()

Types

type Client

type Client interface {
	IsMux() bool   //quic and grpc. if IsMux, then Client is a MuxClient, or it's a SingleClient
	IsSuper() bool // quic handles transport layer dialing and tls layer handshake directly.

	GetPath() string
	IsEarly() bool //is 0-rtt or not.

}

type Conf

type Conf struct {
	TlsConf *tls.Config //for quic

	Host    string
	Addr    netLayer.Addr
	Path    string
	Headers map[string][]string
	IsEarly bool           //is 0-rtt; for quic and ws.
	Extra   map[string]any //quic: useHysteria, hysteria_manual, maxbyte; grpc: multiMode
}

type Creator

type Creator interface {
	//NewClientFromURL(url *url.URL) (Client, error)
	NewClientFromConf(conf *Conf) (Client, error)
	NewServerFromConf(conf *Conf) (Server, error)

	GetDefaultAlpn() (alpn string, mustUse bool)
	PackageID() string
}

type MuxClient

type MuxClient interface {
	Client

	// If IsSuper, underlay should be 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)

	DialSubConn(underlay any) (net.Conn, error)

	ProcessWhenFull(underlay any) //for quic
}

grpc (h2) and quic (h3)

type MuxServer

type MuxServer interface {
	//non-blocking
	StartHandle(underlay net.Conn, newSubConnChan chan net.Conn)
}

grpc

type Server

type Server interface {
	IsMux() bool   //quic and grpc. if IsMux, then Server is a MuxServer, or it's a SingleServer
	IsSuper() bool //quic

	GetPath() string //for ws and grpc

}

type SingleClient

type SingleClient interface {
	Client

	//it's 0-rtt if payload is provided
	Handshake(underlay net.Conn, payload []byte) (net.Conn, error)
}

ws (h1.1)

type SingleServer

type SingleServer interface {
	Handshake(optionalFirstBuffer *bytes.Buffer, underlay net.Conn) (net.Conn, error)
}

ws

type SuperMuxServer

type SuperMuxServer interface {
	MuxServer

	//non-blocking.  Super会直接掌控 原始链接的 监听过程, 并直接向 newSubConnChan 传递 子连接。
	StartListen() (newSubConnChan chan net.Conn, closer io.Closer)
}

quic

Directories

Path Synopsis
Package grpc implements methods for grpc.
Package grpc implements methods for grpc.
Package grpcHardcore implements grpc tunnel without importing google.golang.org/grpc.
Package grpcHardcore 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.

Jump to

Keyboard shortcuts

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