splithttp

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: AGPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const ChromeH2KeepAlivePeriod = 45 * time.Second

consistent with chrome

View Source
const ConnIdleTimeout = 300 * time.Second
View Source
const QuicgoH3KeepAlivePeriod = 10 * time.Second

consistent with quic-go

Variables

View Source
var File_transport_protocols_splithttp_config_proto protoreflect.FileDescriptor

Functions

func IsValidHTTPHost

func IsValidHTTPHost(request string, config string) bool

func NewUploadQueue

func NewUploadQueue(maxPackets int) *uploadQueue

Types

type DefaultDialerClient

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

implements splithttp.DialerClient in terms of direct network connections

func (*DefaultDialerClient) IsClosed

func (c *DefaultDialerClient) IsClosed() bool

func (*DefaultDialerClient) OpenStream

func (c *DefaultDialerClient) OpenStream(ctx context.Context, url string, body io.Reader, uploadOnly bool) (wrc io.ReadCloser, remoteAddr, localAddr gonet.Addr, err error)

func (*DefaultDialerClient) PostPacket

func (c *DefaultDialerClient) PostPacket(ctx context.Context, url string, body io.Reader, contentLength int64) error

type DialerClient

type DialerClient interface {
	IsClosed() bool

	// ctx, url, body, uploadOnly
	OpenStream(context.Context, string, io.Reader, bool) (io.ReadCloser, net.Addr, net.Addr, error)

	// ctx, url, body, contentLength
	PostPacket(context.Context, string, io.Reader, int64) error
}

interface to abstract between use of browser dialer, vs net/http

type DownConfig

type DownConfig struct {
	Address     string           `protobuf:"bytes,8,opt,name=address,proto3" json:"address,omitempty"`
	Port        uint32           `protobuf:"varint,9,opt,name=port,proto3" json:"port,omitempty"`
	XhttpConfig *SplitHttpConfig `protobuf:"bytes,2,opt,name=xhttp_config,json=xhttpConfig,proto3" json:"xhttp_config,omitempty"`
	// Types that are valid to be assigned to Security:
	//
	//	*DownConfig_Tls
	//	*DownConfig_Reality
	Security isDownConfig_Security `protobuf_oneof:"security"`
	// contains filtered or unexported fields
}

func (*DownConfig) Descriptor deprecated

func (*DownConfig) Descriptor() ([]byte, []int)

Deprecated: Use DownConfig.ProtoReflect.Descriptor instead.

func (*DownConfig) GetAddress

func (x *DownConfig) GetAddress() string

func (*DownConfig) GetPort

func (x *DownConfig) GetPort() uint32

func (*DownConfig) GetReality

func (x *DownConfig) GetReality() *reality.RealityConfig

func (*DownConfig) GetSecurity

func (x *DownConfig) GetSecurity() isDownConfig_Security

func (*DownConfig) GetTls

func (x *DownConfig) GetTls() *tls.TlsConfig

func (*DownConfig) GetXhttpConfig

func (x *DownConfig) GetXhttpConfig() *SplitHttpConfig

func (*DownConfig) ProtoMessage

func (*DownConfig) ProtoMessage()

func (*DownConfig) ProtoReflect

func (x *DownConfig) ProtoReflect() protoreflect.Message

func (*DownConfig) Reset

func (x *DownConfig) Reset()

func (*DownConfig) String

func (x *DownConfig) String() string

type DownConfig_Reality

type DownConfig_Reality struct {
	Reality *reality.RealityConfig `protobuf:"bytes,21,opt,name=reality,proto3,oneof"`
}

type DownConfig_Tls

type DownConfig_Tls struct {
	Tls *tls.TlsConfig `protobuf:"bytes,20,opt,name=tls,proto3,oneof"`
}

type FakePacketConn

type FakePacketConn struct {
	net.Conn
}

func (*FakePacketConn) LocalAddr

func (c *FakePacketConn) LocalAddr() net.Addr

func (*FakePacketConn) ReadFrom

func (c *FakePacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

func (*FakePacketConn) SetReadBuffer

func (c *FakePacketConn) SetReadBuffer(bytes int) error

func (*FakePacketConn) WriteTo

func (c *FakePacketConn) WriteTo(p []byte, _ net.Addr) (n int, err error)

type H1Conn

type H1Conn struct {
	UnreadedResponsesCount int
	RespBufReader          *bufio.Reader
	net.Conn
}

func NewH1Conn

func NewH1Conn(conn net.Conn) *H1Conn

type Listener

type Listener struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func ListenXH

func ListenXH(ctx context.Context, addr net.Destination,
	config *SplitHttpConfig, li i.Listener,
	addConn func(net.Conn)) (*Listener, error)

func (*Listener) Addr

func (ln *Listener) Addr() net.Addr

Addr implements net.Listener.Addr().

func (*Listener) Close

func (ln *Listener) Close() error

Close implements net.Listener.Close().

type Packet

type Packet struct {
	Reader  io.ReadCloser
	Payload []byte
	Seq     uint64
}

type RangeConfig

type RangeConfig struct {
	From int32 `protobuf:"varint,1,opt,name=from,proto3" json:"from,omitempty"`
	To   int32 `protobuf:"varint,2,opt,name=to,proto3" json:"to,omitempty"`
	// contains filtered or unexported fields
}

func (*RangeConfig) Descriptor deprecated

func (*RangeConfig) Descriptor() ([]byte, []int)

Deprecated: Use RangeConfig.ProtoReflect.Descriptor instead.

func (*RangeConfig) GetFrom

func (x *RangeConfig) GetFrom() int32

func (*RangeConfig) GetTo

func (x *RangeConfig) GetTo() int32

func (*RangeConfig) ProtoMessage

func (*RangeConfig) ProtoMessage()

func (*RangeConfig) ProtoReflect

func (x *RangeConfig) ProtoReflect() protoreflect.Message

func (*RangeConfig) Reset

func (x *RangeConfig) Reset()

func (*RangeConfig) String

func (x *RangeConfig) String() string

type SplitHttpConfig

type SplitHttpConfig struct {
	Host          string            `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
	Path          string            `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
	Mode          string            `protobuf:"bytes,3,opt,name=mode,proto3" json:"mode,omitempty"`
	Headers       map[string]string `` /* 141-byte string literal not displayed */
	XPaddingBytes *RangeConfig      `protobuf:"bytes,5,opt,name=xPaddingBytes,proto3" json:"xPaddingBytes,omitempty"`
	NoGRPCHeader  bool              `protobuf:"varint,6,opt,name=noGRPCHeader,proto3" json:"noGRPCHeader,omitempty"`
	// server only
	NoSSEHeader          bool         `protobuf:"varint,7,opt,name=noSSEHeader,proto3" json:"noSSEHeader,omitempty"`
	ScMaxEachPostBytes   *RangeConfig `protobuf:"bytes,8,opt,name=scMaxEachPostBytes,proto3" json:"scMaxEachPostBytes,omitempty"`
	ScMinPostsIntervalMs *RangeConfig `protobuf:"bytes,9,opt,name=scMinPostsIntervalMs,proto3" json:"scMinPostsIntervalMs,omitempty"`
	// server only
	ScMaxBufferedPosts int64 `protobuf:"varint,10,opt,name=scMaxBufferedPosts,proto3" json:"scMaxBufferedPosts,omitempty"`
	// server only
	ScStreamUpServerSecs *RangeConfig `protobuf:"bytes,11,opt,name=scStreamUpServerSecs,proto3" json:"scStreamUpServerSecs,omitempty"`
	Xmux                 *XmuxConfig  `protobuf:"bytes,12,opt,name=xmux,proto3" json:"xmux,omitempty"`
	DownloadSettings     *DownConfig  `protobuf:"bytes,13,opt,name=downloadSettings,proto3" json:"downloadSettings,omitempty"`
	// contains filtered or unexported fields
}

func (*SplitHttpConfig) Descriptor deprecated

func (*SplitHttpConfig) Descriptor() ([]byte, []int)

Deprecated: Use SplitHttpConfig.ProtoReflect.Descriptor instead.

func (*SplitHttpConfig) GetDownloadSettings

func (x *SplitHttpConfig) GetDownloadSettings() *DownConfig

func (*SplitHttpConfig) GetHeaders

func (x *SplitHttpConfig) GetHeaders() map[string]string

func (*SplitHttpConfig) GetHost

func (x *SplitHttpConfig) GetHost() string

func (*SplitHttpConfig) GetMode

func (x *SplitHttpConfig) GetMode() string

func (*SplitHttpConfig) GetNoGRPCHeader

func (x *SplitHttpConfig) GetNoGRPCHeader() bool

func (*SplitHttpConfig) GetNoSSEHeader

func (x *SplitHttpConfig) GetNoSSEHeader() bool

func (*SplitHttpConfig) GetNormalizedPath

func (c *SplitHttpConfig) GetNormalizedPath() string

func (*SplitHttpConfig) GetNormalizedQuery

func (c *SplitHttpConfig) GetNormalizedQuery() string

func (*SplitHttpConfig) GetNormalizedScMaxBufferedPosts

func (c *SplitHttpConfig) GetNormalizedScMaxBufferedPosts() int

func (*SplitHttpConfig) GetNormalizedScMaxEachPostBytes

func (c *SplitHttpConfig) GetNormalizedScMaxEachPostBytes() RangeConfig

func (*SplitHttpConfig) GetNormalizedScMinPostsIntervalMs

func (c *SplitHttpConfig) GetNormalizedScMinPostsIntervalMs() RangeConfig

func (*SplitHttpConfig) GetNormalizedScStreamUpServerSecs

func (c *SplitHttpConfig) GetNormalizedScStreamUpServerSecs() RangeConfig

func (*SplitHttpConfig) GetNormalizedXPaddingBytes

func (c *SplitHttpConfig) GetNormalizedXPaddingBytes() RangeConfig

func (*SplitHttpConfig) GetPath

func (x *SplitHttpConfig) GetPath() string

func (*SplitHttpConfig) GetRequestHeader

func (c *SplitHttpConfig) GetRequestHeader(rawURL string) (http.Header, error)

func (*SplitHttpConfig) GetScMaxBufferedPosts

func (x *SplitHttpConfig) GetScMaxBufferedPosts() int64

func (*SplitHttpConfig) GetScMaxEachPostBytes

func (x *SplitHttpConfig) GetScMaxEachPostBytes() *RangeConfig

func (*SplitHttpConfig) GetScMinPostsIntervalMs

func (x *SplitHttpConfig) GetScMinPostsIntervalMs() *RangeConfig

func (*SplitHttpConfig) GetScStreamUpServerSecs

func (x *SplitHttpConfig) GetScStreamUpServerSecs() *RangeConfig

func (*SplitHttpConfig) GetXPaddingBytes

func (x *SplitHttpConfig) GetXPaddingBytes() *RangeConfig

func (*SplitHttpConfig) GetXmux

func (x *SplitHttpConfig) GetXmux() *XmuxConfig

func (*SplitHttpConfig) ProtoMessage

func (*SplitHttpConfig) ProtoMessage()

func (*SplitHttpConfig) ProtoReflect

func (x *SplitHttpConfig) ProtoReflect() protoreflect.Message

func (*SplitHttpConfig) Reset

func (x *SplitHttpConfig) Reset()

func (*SplitHttpConfig) String

func (x *SplitHttpConfig) String() string

func (*SplitHttpConfig) WriteResponseHeader

func (c *SplitHttpConfig) WriteResponseHeader(writer http.ResponseWriter)

type WaitReadCloser

type WaitReadCloser struct {
	Wait chan struct{}
	io.ReadCloser
}

func (*WaitReadCloser) Close

func (w *WaitReadCloser) Close() error

func (*WaitReadCloser) Read

func (w *WaitReadCloser) Read(b []byte) (int, error)

func (*WaitReadCloser) Set

func (w *WaitReadCloser) Set(rc io.ReadCloser)

type XhttpDialer

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

func NewXhttpDialer

func NewXhttpDialer(config *SplitHttpConfig, sc security.Engine,
	dialer i.DialerListener, dnsServer i.ECHResolver) (*XhttpDialer, error)

func (*XhttpDialer) Dial

func (x *XhttpDialer) Dial(ctx context.Context, dest net.Destination) (net.Conn, error)

type XmuxClient

type XmuxClient struct {
	XmuxConn  XmuxConn
	OpenUsage atomic.Int32

	LeftRequests atomic.Int32
	UnreusableAt time.Time
	// contains filtered or unexported fields
}

type XmuxConfig

type XmuxConfig struct {
	MaxConcurrency   *RangeConfig `protobuf:"bytes,1,opt,name=maxConcurrency,proto3" json:"maxConcurrency,omitempty"`
	MaxConnections   *RangeConfig `protobuf:"bytes,2,opt,name=maxConnections,proto3" json:"maxConnections,omitempty"`
	CMaxReuseTimes   *RangeConfig `protobuf:"bytes,3,opt,name=cMaxReuseTimes,proto3" json:"cMaxReuseTimes,omitempty"`
	HMaxRequestTimes *RangeConfig `protobuf:"bytes,4,opt,name=hMaxRequestTimes,proto3" json:"hMaxRequestTimes,omitempty"`
	HMaxReusableSecs *RangeConfig `protobuf:"bytes,5,opt,name=hMaxReusableSecs,proto3" json:"hMaxReusableSecs,omitempty"`
	HKeepAlivePeriod int64        `protobuf:"varint,6,opt,name=hKeepAlivePeriod,proto3" json:"hKeepAlivePeriod,omitempty"`
	// contains filtered or unexported fields
}

func (*XmuxConfig) Descriptor deprecated

func (*XmuxConfig) Descriptor() ([]byte, []int)

Deprecated: Use XmuxConfig.ProtoReflect.Descriptor instead.

func (*XmuxConfig) GetCMaxReuseTimes

func (x *XmuxConfig) GetCMaxReuseTimes() *RangeConfig

func (*XmuxConfig) GetHKeepAlivePeriod

func (x *XmuxConfig) GetHKeepAlivePeriod() int64

func (*XmuxConfig) GetHMaxRequestTimes

func (x *XmuxConfig) GetHMaxRequestTimes() *RangeConfig

func (*XmuxConfig) GetHMaxReusableSecs

func (x *XmuxConfig) GetHMaxReusableSecs() *RangeConfig

func (*XmuxConfig) GetMaxConcurrency

func (x *XmuxConfig) GetMaxConcurrency() *RangeConfig

func (*XmuxConfig) GetMaxConnections

func (x *XmuxConfig) GetMaxConnections() *RangeConfig

func (*XmuxConfig) GetNormalizedCMaxReuseTimes

func (m *XmuxConfig) GetNormalizedCMaxReuseTimes() RangeConfig

func (*XmuxConfig) GetNormalizedHMaxRequestTimes

func (m *XmuxConfig) GetNormalizedHMaxRequestTimes() RangeConfig

func (*XmuxConfig) GetNormalizedHMaxReusableSecs

func (m *XmuxConfig) GetNormalizedHMaxReusableSecs() RangeConfig

func (*XmuxConfig) GetNormalizedMaxConcurrency

func (m *XmuxConfig) GetNormalizedMaxConcurrency() RangeConfig

func (*XmuxConfig) GetNormalizedMaxConnections

func (m *XmuxConfig) GetNormalizedMaxConnections() RangeConfig

func (*XmuxConfig) Init

func (m *XmuxConfig) Init()

func (*XmuxConfig) ProtoMessage

func (*XmuxConfig) ProtoMessage()

func (*XmuxConfig) ProtoReflect

func (x *XmuxConfig) ProtoReflect() protoreflect.Message

func (*XmuxConfig) Reset

func (x *XmuxConfig) Reset()

func (*XmuxConfig) String

func (x *XmuxConfig) String() string

type XmuxConn

type XmuxConn interface {
	IsClosed() bool
}

type XmuxManager

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

func NewXmuxManager

func NewXmuxManager(xmuxConfig XmuxConfig, newConnFunc func() XmuxConn) *XmuxManager

func (*XmuxManager) GetXmuxClient

func (m *XmuxManager) GetXmuxClient(ctx context.Context) *XmuxClient

Jump to

Keyboard shortcuts

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