core: v2ray.com/core/transport/internet/headers/http Index | Files

package http

import "v2ray.com/core/transport/internet/headers/http"

Index

Package Files

config.go config.pb.go errors.generated.go http.go linkedreadRequest.go resp.go

Constants

const (
    // CRLF is the line ending in HTTP header
    CRLF = "\r\n"

    // ENDING is the double line ending between HTTP header and body.
    ENDING = CRLF + CRLF
)

Variables

var (
    ErrHeaderToLong = newError("Header too long.")

    ErrHeaderMisMatch = newError("Header Mismatch.")
)
var File_transport_internet_headers_http_config_proto protoreflect.FileDescriptor

type Config Uses

type Config struct {

    // Settings for authenticating requests. If not set, client side will not send
    // authenication header, and server side will bypass authentication.
    Request *RequestConfig `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"`
    // Settings for authenticating responses. If not set, client side will bypass
    // authentication, and server side will not send authentication header.
    Response *ResponseConfig `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"`
    // contains filtered or unexported fields
}

func (*Config) Descriptor Uses

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

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetRequest Uses

func (x *Config) GetRequest() *RequestConfig

func (*Config) GetResponse Uses

func (x *Config) GetResponse() *ResponseConfig

func (*Config) ProtoMessage Uses

func (*Config) ProtoMessage()

func (*Config) ProtoReflect Uses

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

func (*Config) Reset Uses

func (x *Config) Reset()

func (*Config) String Uses

func (x *Config) String() string
type Header struct {

    // "Accept", "Cookie", etc
    Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
    // Each entry must be valid in one piece. Random entry will be chosen if
    // multiple entries present.
    Value []string `protobuf:"bytes,2,rep,name=value,proto3" json:"value,omitempty"`
    // contains filtered or unexported fields
}

func (*Header) Descriptor Uses

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

Deprecated: Use Header.ProtoReflect.Descriptor instead.

func (*Header) GetName Uses

func (x *Header) GetName() string

func (*Header) GetValue Uses

func (x *Header) GetValue() []string

func (*Header) ProtoMessage Uses

func (*Header) ProtoMessage()

func (*Header) ProtoReflect Uses

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

func (*Header) Reset Uses

func (x *Header) Reset()

func (*Header) String Uses

func (x *Header) String() string

type HeaderReader Uses

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

func (*HeaderReader) ExpectThisRequest Uses

func (h *HeaderReader) ExpectThisRequest(expectedHeader *RequestConfig) *HeaderReader

func (*HeaderReader) Read Uses

func (h *HeaderReader) Read(reader io.Reader) (*buf.Buffer, error)

type HeaderWriter Uses

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

func NewHeaderWriter Uses

func NewHeaderWriter(header *buf.Buffer) *HeaderWriter

func (*HeaderWriter) Write Uses

func (w *HeaderWriter) Write(writer io.Writer) error

type HttpAuthenticator Uses

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

func NewHttpAuthenticator Uses

func NewHttpAuthenticator(ctx context.Context, config *Config) (HttpAuthenticator, error)

func (HttpAuthenticator) Client Uses

func (a HttpAuthenticator) Client(conn net.Conn) net.Conn

func (HttpAuthenticator) GetClientWriter Uses

func (a HttpAuthenticator) GetClientWriter() *HeaderWriter

func (HttpAuthenticator) GetServerWriter Uses

func (a HttpAuthenticator) GetServerWriter() *HeaderWriter

func (HttpAuthenticator) Server Uses

func (a HttpAuthenticator) Server(conn net.Conn) net.Conn

type HttpConn Uses

type HttpConn struct {
    net.Conn
    // contains filtered or unexported fields
}

func NewHttpConn Uses

func NewHttpConn(conn net.Conn, reader Reader, writer Writer, errorWriter Writer, errorMismatchWriter Writer, errorTooLongWriter Writer) *HttpConn

func (*HttpConn) Close Uses

func (c *HttpConn) Close() error

Close implements net.Conn.Close().

func (*HttpConn) Read Uses

func (c *HttpConn) Read(b []byte) (int, error)

func (*HttpConn) Write Uses

func (c *HttpConn) Write(b []byte) (int, error)

Write implements io.Writer.

type Method Uses

type Method struct {
    Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
    // contains filtered or unexported fields
}

HTTP method. Default value "GET".

func (*Method) Descriptor Uses

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

Deprecated: Use Method.ProtoReflect.Descriptor instead.

func (*Method) GetValue Uses

func (x *Method) GetValue() string

func (*Method) ProtoMessage Uses

func (*Method) ProtoMessage()

func (*Method) ProtoReflect Uses

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

func (*Method) Reset Uses

func (x *Method) Reset()

func (*Method) String Uses

func (x *Method) String() string

type NoOpReader Uses

type NoOpReader struct{}

func (NoOpReader) Read Uses

func (NoOpReader) Read(io.Reader) (*buf.Buffer, error)

type NoOpWriter Uses

type NoOpWriter struct{}

func (NoOpWriter) Write Uses

func (NoOpWriter) Write(io.Writer) error

type Reader Uses

type Reader interface {
    Read(io.Reader) (*buf.Buffer, error)
}

type RequestConfig Uses

type RequestConfig struct {

    // Full HTTP version like "1.1".
    Version *Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
    // GET, POST, CONNECT etc
    Method *Method `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"`
    // URI like "/login.php"
    Uri    []string  `protobuf:"bytes,3,rep,name=uri,proto3" json:"uri,omitempty"`
    Header []*Header `protobuf:"bytes,4,rep,name=header,proto3" json:"header,omitempty"`
    // contains filtered or unexported fields
}

func (*RequestConfig) Descriptor Uses

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

Deprecated: Use RequestConfig.ProtoReflect.Descriptor instead.

func (*RequestConfig) GetFullVersion Uses

func (v *RequestConfig) GetFullVersion() string

func (*RequestConfig) GetHeader Uses

func (x *RequestConfig) GetHeader() []*Header

func (*RequestConfig) GetMethod Uses

func (x *RequestConfig) GetMethod() *Method

func (*RequestConfig) GetMethodValue Uses

func (v *RequestConfig) GetMethodValue() string

func (*RequestConfig) GetUri Uses

func (x *RequestConfig) GetUri() []string

func (*RequestConfig) GetVersion Uses

func (x *RequestConfig) GetVersion() *Version

func (*RequestConfig) GetVersionValue Uses

func (v *RequestConfig) GetVersionValue() string

func (*RequestConfig) PickHeaders Uses

func (v *RequestConfig) PickHeaders() []string

func (*RequestConfig) PickUri Uses

func (v *RequestConfig) PickUri() string

func (*RequestConfig) ProtoMessage Uses

func (*RequestConfig) ProtoMessage()

func (*RequestConfig) ProtoReflect Uses

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

func (*RequestConfig) Reset Uses

func (x *RequestConfig) Reset()

func (*RequestConfig) String Uses

func (x *RequestConfig) String() string

type ResponseConfig Uses

type ResponseConfig struct {
    Version *Version  `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
    Status  *Status   `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
    Header  []*Header `protobuf:"bytes,3,rep,name=header,proto3" json:"header,omitempty"`
    // contains filtered or unexported fields
}

func (*ResponseConfig) Descriptor Uses

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

Deprecated: Use ResponseConfig.ProtoReflect.Descriptor instead.

func (*ResponseConfig) GetFullVersion Uses

func (v *ResponseConfig) GetFullVersion() string

func (*ResponseConfig) GetHeader Uses

func (x *ResponseConfig) GetHeader() []*Header

func (*ResponseConfig) GetStatus Uses

func (x *ResponseConfig) GetStatus() *Status

func (*ResponseConfig) GetStatusValue Uses

func (v *ResponseConfig) GetStatusValue() *Status

func (*ResponseConfig) GetVersion Uses

func (x *ResponseConfig) GetVersion() *Version

func (*ResponseConfig) GetVersionValue Uses

func (v *ResponseConfig) GetVersionValue() string

func (*ResponseConfig) HasHeader Uses

func (v *ResponseConfig) HasHeader(header string) bool

func (*ResponseConfig) PickHeaders Uses

func (v *ResponseConfig) PickHeaders() []string

func (*ResponseConfig) ProtoMessage Uses

func (*ResponseConfig) ProtoMessage()

func (*ResponseConfig) ProtoReflect Uses

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

func (*ResponseConfig) Reset Uses

func (x *ResponseConfig) Reset()

func (*ResponseConfig) String Uses

func (x *ResponseConfig) String() string

type Status Uses

type Status struct {

    // Status code. Default "200".
    Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
    // Statue reason. Default "OK".
    Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"`
    // contains filtered or unexported fields
}

func (*Status) Descriptor Uses

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

Deprecated: Use Status.ProtoReflect.Descriptor instead.

func (*Status) GetCode Uses

func (x *Status) GetCode() string

func (*Status) GetReason Uses

func (x *Status) GetReason() string

func (*Status) ProtoMessage Uses

func (*Status) ProtoMessage()

func (*Status) ProtoReflect Uses

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

func (*Status) Reset Uses

func (x *Status) Reset()

func (*Status) String Uses

func (x *Status) String() string

type Version Uses

type Version struct {
    Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
    // contains filtered or unexported fields
}

HTTP version. Default value "1.1".

func (*Version) Descriptor Uses

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

Deprecated: Use Version.ProtoReflect.Descriptor instead.

func (*Version) GetValue Uses

func (x *Version) GetValue() string

func (*Version) ProtoMessage Uses

func (*Version) ProtoMessage()

func (*Version) ProtoReflect Uses

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

func (*Version) Reset Uses

func (x *Version) Reset()

func (*Version) String Uses

func (x *Version) String() string

type Writer Uses

type Writer interface {
    Write(io.Writer) error
}

Package http imports 18 packages (graph) and is imported by 10 packages. Updated 2020-10-15. Refresh now. Tools for package owners.