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

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

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"`
    XXX_NoUnkeyedLiteral struct{}        `json:"-"`
    XXX_unrecognized     []byte          `json:"-"`
    XXX_sizecache        int32           `json:"-"`
}

func (*Config) Descriptor Uses

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

func (*Config) GetRequest Uses

func (m *Config) GetRequest() *RequestConfig

func (*Config) GetResponse Uses

func (m *Config) GetResponse() *ResponseConfig

func (*Config) ProtoMessage Uses

func (*Config) ProtoMessage()

func (*Config) Reset Uses

func (m *Config) Reset()

func (*Config) String Uses

func (m *Config) String() string

func (*Config) XXX_DiscardUnknown Uses

func (m *Config) XXX_DiscardUnknown()

func (*Config) XXX_Marshal Uses

func (m *Config) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Config) XXX_Merge Uses

func (m *Config) XXX_Merge(src proto.Message)

func (*Config) XXX_Size Uses

func (m *Config) XXX_Size() int

func (*Config) XXX_Unmarshal Uses

func (m *Config) XXX_Unmarshal(b []byte) error
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"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

func (*Header) Descriptor Uses

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

func (*Header) GetName Uses

func (m *Header) GetName() string

func (*Header) GetValue Uses

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

func (*Header) ProtoMessage Uses

func (*Header) ProtoMessage()

func (*Header) Reset Uses

func (m *Header) Reset()

func (*Header) String Uses

func (m *Header) String() string

func (*Header) XXX_DiscardUnknown Uses

func (m *Header) XXX_DiscardUnknown()

func (*Header) XXX_Marshal Uses

func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Header) XXX_Merge Uses

func (m *Header) XXX_Merge(src proto.Message)

func (*Header) XXX_Size Uses

func (m *Header) XXX_Size() int

func (*Header) XXX_Unmarshal Uses

func (m *Header) XXX_Unmarshal(b []byte) error

type HeaderReader Uses

type HeaderReader struct {
}

func (*HeaderReader) Read Uses

func (*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) *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"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

HTTP method. Default value "GET".

func (*Method) Descriptor Uses

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

func (*Method) GetValue Uses

func (m *Method) GetValue() string

func (*Method) ProtoMessage Uses

func (*Method) ProtoMessage()

func (*Method) Reset Uses

func (m *Method) Reset()

func (*Method) String Uses

func (m *Method) String() string

func (*Method) XXX_DiscardUnknown Uses

func (m *Method) XXX_DiscardUnknown()

func (*Method) XXX_Marshal Uses

func (m *Method) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Method) XXX_Merge Uses

func (m *Method) XXX_Merge(src proto.Message)

func (*Method) XXX_Size Uses

func (m *Method) XXX_Size() int

func (*Method) XXX_Unmarshal Uses

func (m *Method) XXX_Unmarshal(b []byte) error

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"`
    XXX_NoUnkeyedLiteral struct{}  `json:"-"`
    XXX_unrecognized     []byte    `json:"-"`
    XXX_sizecache        int32     `json:"-"`
}

func (*RequestConfig) Descriptor Uses

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

func (*RequestConfig) GetFullVersion Uses

func (v *RequestConfig) GetFullVersion() string

func (*RequestConfig) GetHeader Uses

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

func (*RequestConfig) GetMethod Uses

func (m *RequestConfig) GetMethod() *Method

func (*RequestConfig) GetMethodValue Uses

func (v *RequestConfig) GetMethodValue() string

func (*RequestConfig) GetUri Uses

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

func (*RequestConfig) GetVersion Uses

func (m *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) Reset Uses

func (m *RequestConfig) Reset()

func (*RequestConfig) String Uses

func (m *RequestConfig) String() string

func (*RequestConfig) XXX_DiscardUnknown Uses

func (m *RequestConfig) XXX_DiscardUnknown()

func (*RequestConfig) XXX_Marshal Uses

func (m *RequestConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RequestConfig) XXX_Merge Uses

func (m *RequestConfig) XXX_Merge(src proto.Message)

func (*RequestConfig) XXX_Size Uses

func (m *RequestConfig) XXX_Size() int

func (*RequestConfig) XXX_Unmarshal Uses

func (m *RequestConfig) XXX_Unmarshal(b []byte) error

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"`
    XXX_NoUnkeyedLiteral struct{}  `json:"-"`
    XXX_unrecognized     []byte    `json:"-"`
    XXX_sizecache        int32     `json:"-"`
}

func (*ResponseConfig) Descriptor Uses

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

func (*ResponseConfig) GetFullVersion Uses

func (v *ResponseConfig) GetFullVersion() string

func (*ResponseConfig) GetHeader Uses

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

func (*ResponseConfig) GetStatus Uses

func (m *ResponseConfig) GetStatus() *Status

func (*ResponseConfig) GetStatusValue Uses

func (v *ResponseConfig) GetStatusValue() *Status

func (*ResponseConfig) GetVersion Uses

func (m *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) Reset Uses

func (m *ResponseConfig) Reset()

func (*ResponseConfig) String Uses

func (m *ResponseConfig) String() string

func (*ResponseConfig) XXX_DiscardUnknown Uses

func (m *ResponseConfig) XXX_DiscardUnknown()

func (*ResponseConfig) XXX_Marshal Uses

func (m *ResponseConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ResponseConfig) XXX_Merge Uses

func (m *ResponseConfig) XXX_Merge(src proto.Message)

func (*ResponseConfig) XXX_Size Uses

func (m *ResponseConfig) XXX_Size() int

func (*ResponseConfig) XXX_Unmarshal Uses

func (m *ResponseConfig) XXX_Unmarshal(b []byte) error

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"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

func (*Status) Descriptor Uses

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

func (*Status) GetCode Uses

func (m *Status) GetCode() string

func (*Status) GetReason Uses

func (m *Status) GetReason() string

func (*Status) ProtoMessage Uses

func (*Status) ProtoMessage()

func (*Status) Reset Uses

func (m *Status) Reset()

func (*Status) String Uses

func (m *Status) String() string

func (*Status) XXX_DiscardUnknown Uses

func (m *Status) XXX_DiscardUnknown()

func (*Status) XXX_Marshal Uses

func (m *Status) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Status) XXX_Merge Uses

func (m *Status) XXX_Merge(src proto.Message)

func (*Status) XXX_Size Uses

func (m *Status) XXX_Size() int

func (*Status) XXX_Unmarshal Uses

func (m *Status) XXX_Unmarshal(b []byte) error

type Version Uses

type Version struct {
    Value                string   `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

HTTP version. Default value "1.1".

func (*Version) Descriptor Uses

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

func (*Version) GetValue Uses

func (m *Version) GetValue() string

func (*Version) ProtoMessage Uses

func (*Version) ProtoMessage()

func (*Version) Reset Uses

func (m *Version) Reset()

func (*Version) String Uses

func (m *Version) String() string

func (*Version) XXX_DiscardUnknown Uses

func (m *Version) XXX_DiscardUnknown()

func (*Version) XXX_Marshal Uses

func (m *Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Version) XXX_Merge Uses

func (m *Version) XXX_Merge(src proto.Message)

func (*Version) XXX_Size Uses

func (m *Version) XXX_Size() int

func (*Version) XXX_Unmarshal Uses

func (m *Version) XXX_Unmarshal(b []byte) error

type Writer Uses

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

Package http imports 14 packages (graph) and is imported by 5 packages. Updated 2019-08-05. Refresh now. Tools for package owners.