splithttp

package
v24.12.15 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MPL-2.0 Imports: 42 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_transport_internet_splithttp_config_proto protoreflect.FileDescriptor

Functions

func Dial

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

func ListenSH

func ListenSH(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{}

implements splithttp.DialerClient in terms of browser dialer has no fields because everything is global state :O)

func (*BrowserDialerClient) IsClosed added in v24.12.15

func (c *BrowserDialerClient) IsClosed() bool

func (*BrowserDialerClient) Open added in v24.11.30

func (*BrowserDialerClient) OpenDownload

func (c *BrowserDialerClient) OpenDownload(ctx context.Context, baseURL string) (io.ReadCloser, gonet.Addr, gonet.Addr, error)

func (*BrowserDialerClient) OpenUpload added in v24.11.11

func (c *BrowserDialerClient) OpenUpload(ctx context.Context, baseURL string) io.WriteCloser

func (*BrowserDialerClient) SendUploadRequest

func (c *BrowserDialerClient) SendUploadRequest(ctx context.Context, url string, payload io.ReadWriteCloser, 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      `` /* 155-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"`
	Xmux                 *XmuxConfig            `protobuf:"bytes,11,opt,name=xmux,proto3" json:"xmux,omitempty"`
	DownloadSettings     *internet.StreamConfig `protobuf:"bytes,12,opt,name=downloadSettings,proto3" json:"downloadSettings,omitempty"`
	// contains filtered or unexported fields
}

func (*Config) Descriptor deprecated

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

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetDownloadSettings

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

func (*Config) GetHeaders added in v24.12.15

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

func (*Config) GetHost

func (x *Config) GetHost() string

func (*Config) GetMode added in v24.11.11

func (x *Config) GetMode() string

func (*Config) GetNoGRPCHeader added in v24.11.21

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 added in v24.12.15

func (c *Config) GetNormalizedScMaxBufferedPosts() int

func (*Config) GetNormalizedScMaxEachPostBytes

func (c *Config) GetNormalizedScMaxEachPostBytes() RangeConfig

func (*Config) GetNormalizedScMinPostsIntervalMs

func (c *Config) GetNormalizedScMinPostsIntervalMs() RangeConfig

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 added in v24.12.15

func (x *Config) GetScMaxBufferedPosts() int64

func (*Config) GetScMaxEachPostBytes

func (x *Config) GetScMaxEachPostBytes() *RangeConfig

func (*Config) GetScMinPostsIntervalMs

func (x *Config) GetScMinPostsIntervalMs() *RangeConfig

func (*Config) GetXPaddingBytes

func (x *Config) GetXPaddingBytes() *RangeConfig

func (*Config) GetXmux

func (x *Config) GetXmux() *XmuxConfig

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 added in v24.12.15

func (c *DefaultDialerClient) IsClosed() bool

func (*DefaultDialerClient) Open added in v24.11.30

func (*DefaultDialerClient) OpenDownload

func (c *DefaultDialerClient) OpenDownload(ctx context.Context, baseURL string) (io.ReadCloser, gonet.Addr, gonet.Addr, error)

func (*DefaultDialerClient) OpenUpload added in v24.11.11

func (c *DefaultDialerClient) OpenUpload(ctx context.Context, baseURL string) io.WriteCloser

func (*DefaultDialerClient) SendUploadRequest

func (c *DefaultDialerClient) SendUploadRequest(ctx context.Context, url string, payload io.ReadWriteCloser, contentLength int64) error

type DialerClient

type DialerClient interface {
	IsClosed() bool

	// (ctx, baseURL, payload) -> err
	// baseURL already contains sessionId and seq
	SendUploadRequest(context.Context, string, io.ReadWriteCloser, int64) error

	// (ctx, baseURL) -> (downloadReader, remoteAddr, localAddr)
	// baseURL already contains sessionId
	OpenDownload(context.Context, string) (io.ReadCloser, net.Addr, net.Addr, error)

	// (ctx, baseURL) -> uploadWriter
	// baseURL already contains sessionId
	OpenUpload(context.Context, string) io.WriteCloser

	// (ctx, pureURL) -> (uploadWriter, downloadReader)
	// pureURL can not contain sessionId
	Open(context.Context, string) (io.WriteCloser, io.ReadCloser)
}

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 LazyReader

type LazyReader struct {
	CreateReader func() (io.Reader, error)
	// contains filtered or unexported fields
}

Close is intentionally not supported by LazyReader because it's not clear how CreateReader should be aborted in case of Close. It's best to wrap LazyReader in another struct that handles Close correctly, or better, stop using LazyReader entirely.

func (*LazyReader) Read

func (r *LazyReader) Read(b []byte) (int, error)

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 RangeConfig added in v24.12.15

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 added in v24.12.15

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

Deprecated: Use RangeConfig.ProtoReflect.Descriptor instead.

func (*RangeConfig) GetFrom added in v24.12.15

func (x *RangeConfig) GetFrom() int32

func (*RangeConfig) GetTo added in v24.12.15

func (x *RangeConfig) GetTo() int32

func (*RangeConfig) ProtoMessage added in v24.12.15

func (*RangeConfig) ProtoMessage()

func (*RangeConfig) ProtoReflect added in v24.12.15

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

func (*RangeConfig) Reset added in v24.12.15

func (x *RangeConfig) Reset()

func (*RangeConfig) String added in v24.12.15

func (x *RangeConfig) String() string

type WaitReadCloser added in v24.11.30

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

func (*WaitReadCloser) Close added in v24.11.30

func (w *WaitReadCloser) Close() error

func (*WaitReadCloser) Read added in v24.11.30

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

func (*WaitReadCloser) Set added in v24.11.30

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

type XmuxClient added in v24.12.15

type XmuxClient struct {
	XmuxConn  XmuxConn
	OpenUsage atomic.Int32

	LeftRequests atomic.Int32
	// contains filtered or unexported fields
}

type XmuxConfig added in v24.12.15

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"`
	CMaxLifetimeMs   *RangeConfig `protobuf:"bytes,4,opt,name=cMaxLifetimeMs,proto3" json:"cMaxLifetimeMs,omitempty"`
	HMaxRequestTimes *RangeConfig `protobuf:"bytes,5,opt,name=hMaxRequestTimes,proto3" json:"hMaxRequestTimes,omitempty"`
	HKeepAlivePeriod int64        `protobuf:"varint,6,opt,name=hKeepAlivePeriod,proto3" json:"hKeepAlivePeriod,omitempty"`
	// contains filtered or unexported fields
}

func (*XmuxConfig) Descriptor deprecated added in v24.12.15

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

Deprecated: Use XmuxConfig.ProtoReflect.Descriptor instead.

func (*XmuxConfig) GetCMaxLifetimeMs added in v24.12.15

func (x *XmuxConfig) GetCMaxLifetimeMs() *RangeConfig

func (*XmuxConfig) GetCMaxReuseTimes added in v24.12.15

func (x *XmuxConfig) GetCMaxReuseTimes() *RangeConfig

func (*XmuxConfig) GetHKeepAlivePeriod added in v24.12.15

func (x *XmuxConfig) GetHKeepAlivePeriod() int64

func (*XmuxConfig) GetHMaxRequestTimes added in v24.12.15

func (x *XmuxConfig) GetHMaxRequestTimes() *RangeConfig

func (*XmuxConfig) GetMaxConcurrency added in v24.12.15

func (x *XmuxConfig) GetMaxConcurrency() *RangeConfig

func (*XmuxConfig) GetMaxConnections added in v24.12.15

func (x *XmuxConfig) GetMaxConnections() *RangeConfig

func (*XmuxConfig) GetNormalizedCMaxLifetimeMs added in v24.12.15

func (m *XmuxConfig) GetNormalizedCMaxLifetimeMs() RangeConfig

func (*XmuxConfig) GetNormalizedCMaxRequestTimes added in v24.12.15

func (m *XmuxConfig) GetNormalizedCMaxRequestTimes() RangeConfig

func (*XmuxConfig) GetNormalizedCMaxReuseTimes added in v24.12.15

func (m *XmuxConfig) GetNormalizedCMaxReuseTimes() RangeConfig

func (*XmuxConfig) GetNormalizedMaxConcurrency added in v24.12.15

func (m *XmuxConfig) GetNormalizedMaxConcurrency() RangeConfig

func (*XmuxConfig) GetNormalizedMaxConnections added in v24.12.15

func (m *XmuxConfig) GetNormalizedMaxConnections() RangeConfig

func (*XmuxConfig) ProtoMessage added in v24.12.15

func (*XmuxConfig) ProtoMessage()

func (*XmuxConfig) ProtoReflect added in v24.12.15

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

func (*XmuxConfig) Reset added in v24.12.15

func (x *XmuxConfig) Reset()

func (*XmuxConfig) String added in v24.12.15

func (x *XmuxConfig) String() string

type XmuxConn added in v24.12.15

type XmuxConn interface {
	IsClosed() bool
}

type XmuxManager added in v24.12.15

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

func NewXmuxManager added in v24.12.15

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

func (*XmuxManager) GetXmuxClient added in v24.12.15

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