splithttp

package
v1.260206.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MPL-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlacementQueryInHeader = "queryInHeader"
	PlacementCookie        = "cookie"
	PlacementHeader        = "header"
	PlacementQuery         = "query"
	PlacementPath          = "path"
	PlacementBody          = "body"
)

Variables

View Source
var File_transport_internet_splithttp_config_proto protoreflect.FileDescriptor

Functions

func ApplyPaddingToCookie

func ApplyPaddingToCookie(req *http.Request, name, value string)

func ApplyPaddingToQuery

func ApplyPaddingToQuery(u *url.URL, key, value string)

func Dial

func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.MemoryStreamConfig) (stat.Connection, error)

func GeneratePadding

func GeneratePadding(method PaddingMethod, length int) string

func GenerateTokenishPaddingBase62

func GenerateTokenishPaddingBase62(targetHuffmanBytes int) string

func ListenXH

func ListenXH(ctx context.Context, address net.Address, port net.Port, streamSettings *internet.MemoryStreamConfig, addConn internet.ConnHandler) (internet.Listener, error)

func NewUploadQueue

func NewUploadQueue(maxPackets int) *uploadQueue

Types

type BrowserDialerClient

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

BrowserDialerClient implements splithttp.DialerClient in terms of browser dialer

func (*BrowserDialerClient) IsClosed

func (c *BrowserDialerClient) IsClosed() bool

func (*BrowserDialerClient) OpenStream

func (c *BrowserDialerClient) OpenStream(ctx context.Context, url string, _ string, body io.Reader, uploadOnly bool) (io.ReadCloser, net.Addr, net.Addr, error)

func (*BrowserDialerClient) PostPacket

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

type Config

type Config 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"`
	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"`
	ScMaxBufferedPosts   int64                  `protobuf:"varint,10,opt,name=scMaxBufferedPosts,proto3" json:"scMaxBufferedPosts,omitempty"`
	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     *internet.StreamConfig `protobuf:"bytes,13,opt,name=downloadSettings,proto3" json:"downloadSettings,omitempty"`
	XPaddingObfsMode     bool                   `protobuf:"varint,14,opt,name=xPaddingObfsMode,proto3" json:"xPaddingObfsMode,omitempty"`
	XPaddingKey          string                 `protobuf:"bytes,15,opt,name=xPaddingKey,proto3" json:"xPaddingKey,omitempty"`
	XPaddingHeader       string                 `protobuf:"bytes,16,opt,name=xPaddingHeader,proto3" json:"xPaddingHeader,omitempty"`
	XPaddingPlacement    string                 `protobuf:"bytes,17,opt,name=xPaddingPlacement,proto3" json:"xPaddingPlacement,omitempty"`
	XPaddingMethod       string                 `protobuf:"bytes,18,opt,name=xPaddingMethod,proto3" json:"xPaddingMethod,omitempty"`
	UplinkHTTPMethod     string                 `protobuf:"bytes,19,opt,name=uplinkHTTPMethod,proto3" json:"uplinkHTTPMethod,omitempty"`
	SessionPlacement     string                 `protobuf:"bytes,20,opt,name=sessionPlacement,proto3" json:"sessionPlacement,omitempty"`
	SessionKey           string                 `protobuf:"bytes,21,opt,name=sessionKey,proto3" json:"sessionKey,omitempty"`
	SeqPlacement         string                 `protobuf:"bytes,22,opt,name=seqPlacement,proto3" json:"seqPlacement,omitempty"`
	SeqKey               string                 `protobuf:"bytes,23,opt,name=seqKey,proto3" json:"seqKey,omitempty"`
	UplinkDataPlacement  string                 `protobuf:"bytes,24,opt,name=uplinkDataPlacement,proto3" json:"uplinkDataPlacement,omitempty"`
	UplinkDataKey        string                 `protobuf:"bytes,25,opt,name=uplinkDataKey,proto3" json:"uplinkDataKey,omitempty"`
	UplinkChunkSize      uint32                 `protobuf:"varint,26,opt,name=uplinkChunkSize,proto3" json:"uplinkChunkSize,omitempty"`
	// contains filtered or unexported fields
}

func (*Config) ApplyMetaToRequest

func (c *Config) ApplyMetaToRequest(req *http.Request, sessionId string, seqStr string)

func (*Config) ApplyXPaddingToHeader

func (c *Config) ApplyXPaddingToHeader(h http.Header, config XPaddingConfig)

func (*Config) ApplyXPaddingToRequest

func (c *Config) ApplyXPaddingToRequest(req *http.Request, config XPaddingConfig)

func (*Config) Descriptor deprecated

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

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) ExtractMetaFromRequest

func (c *Config) ExtractMetaFromRequest(req *http.Request, path string) (sessionId string, seqStr string)

func (*Config) ExtractXPaddingFromRequest

func (c *Config) ExtractXPaddingFromRequest(req *http.Request, obfsMode bool) (string, string)

func (*Config) GetDownloadSettings

func (x *Config) GetDownloadSettings() *internet.StreamConfig

func (*Config) GetHeaders

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

func (*Config) GetHost

func (x *Config) GetHost() string

func (*Config) GetMode

func (x *Config) GetMode() string

func (*Config) GetNoGRPCHeader

func (x *Config) GetNoGRPCHeader() bool

func (*Config) GetNoSSEHeader

func (x *Config) GetNoSSEHeader() bool

func (*Config) GetNormalizedPath

func (c *Config) GetNormalizedPath() string

func (*Config) GetNormalizedQuery

func (c *Config) GetNormalizedQuery() string

func (*Config) GetNormalizedScMaxBufferedPosts

func (c *Config) GetNormalizedScMaxBufferedPosts() int

func (*Config) GetNormalizedScMaxEachPostBytes

func (c *Config) GetNormalizedScMaxEachPostBytes() RangeConfig

func (*Config) GetNormalizedScMinPostsIntervalMs

func (c *Config) GetNormalizedScMinPostsIntervalMs() RangeConfig

func (*Config) GetNormalizedScStreamUpServerSecs

func (c *Config) GetNormalizedScStreamUpServerSecs() RangeConfig

func (*Config) GetNormalizedSeqKey

func (c *Config) GetNormalizedSeqKey() string

func (*Config) GetNormalizedSeqPlacement

func (c *Config) GetNormalizedSeqPlacement() string

func (*Config) GetNormalizedSessionKey

func (c *Config) GetNormalizedSessionKey() string

func (*Config) GetNormalizedSessionPlacement

func (c *Config) GetNormalizedSessionPlacement() string

func (*Config) GetNormalizedUplinkDataPlacement

func (c *Config) GetNormalizedUplinkDataPlacement() string

func (*Config) GetNormalizedUplinkHTTPMethod

func (c *Config) GetNormalizedUplinkHTTPMethod() string

func (*Config) GetNormalizedXPaddingBytes

func (c *Config) GetNormalizedXPaddingBytes() RangeConfig

func (*Config) GetPath

func (x *Config) GetPath() string

func (*Config) GetRequestHeader

func (c *Config) GetRequestHeader() http.Header

func (*Config) GetScMaxBufferedPosts

func (x *Config) GetScMaxBufferedPosts() int64

func (*Config) GetScMaxEachPostBytes

func (x *Config) GetScMaxEachPostBytes() *RangeConfig

func (*Config) GetScMinPostsIntervalMs

func (x *Config) GetScMinPostsIntervalMs() *RangeConfig

func (*Config) GetScStreamUpServerSecs

func (x *Config) GetScStreamUpServerSecs() *RangeConfig

func (*Config) GetSeqKey

func (x *Config) GetSeqKey() string

func (*Config) GetSeqPlacement

func (x *Config) GetSeqPlacement() string

func (*Config) GetSessionKey

func (x *Config) GetSessionKey() string

func (*Config) GetSessionPlacement

func (x *Config) GetSessionPlacement() string

func (*Config) GetUplinkChunkSize

func (x *Config) GetUplinkChunkSize() uint32

func (*Config) GetUplinkDataKey

func (x *Config) GetUplinkDataKey() string

func (*Config) GetUplinkDataPlacement

func (x *Config) GetUplinkDataPlacement() string

func (*Config) GetUplinkHTTPMethod

func (x *Config) GetUplinkHTTPMethod() string

func (*Config) GetXPaddingBytes

func (x *Config) GetXPaddingBytes() *RangeConfig

func (*Config) GetXPaddingHeader

func (x *Config) GetXPaddingHeader() string

func (*Config) GetXPaddingKey

func (x *Config) GetXPaddingKey() string

func (*Config) GetXPaddingMethod

func (x *Config) GetXPaddingMethod() string

func (*Config) GetXPaddingObfsMode

func (x *Config) GetXPaddingObfsMode() bool

func (*Config) GetXPaddingPlacement

func (x *Config) GetXPaddingPlacement() string

func (*Config) GetXmux

func (x *Config) GetXmux() *XmuxConfig

func (*Config) IsPaddingValid

func (c *Config) IsPaddingValid(paddingValue string, from, to int32, method PaddingMethod) bool

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

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

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

func (*Config) WriteResponseHeader

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

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, sessionId string, body io.Reader, uploadOnly bool) (wrc io.ReadCloser, remoteAddr, localAddr net.Addr, err error)

func (*DefaultDialerClient) PostPacket

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

type DialerClient

type DialerClient interface {
	IsClosed() bool

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

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

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

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 (*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 PaddingMethod

type PaddingMethod string
const (
	PaddingMethodRepeatX  PaddingMethod = "repeat-x"
	PaddingMethodTokenish PaddingMethod = "tokenish"
)

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 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 XPaddingConfig

type XPaddingConfig struct {
	Length    int
	Placement XPaddingPlacement
	Method    PaddingMethod
}

type XPaddingPlacement

type XPaddingPlacement struct {
	Placement string
	Key       string
	Header    string
	RawURL    string
}

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) 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