core: v2ray.com/core/proxy/trojan Index | Files

package trojan

import "v2ray.com/core/proxy/trojan"

Index

Package Files

client.go config.go config.pb.go errors.generated.go protocol.go server.go trojan.go validator.go

Variables

var File_proxy_trojan_config_proto protoreflect.FileDescriptor

type Account Uses

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

func (*Account) AsAccount Uses

func (a *Account) AsAccount() (protocol.Account, error)

AsAccount implements protocol.AsAccount.

func (*Account) Descriptor Uses

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

Deprecated: Use Account.ProtoReflect.Descriptor instead.

func (*Account) GetPassword Uses

func (x *Account) GetPassword() string

func (*Account) ProtoMessage Uses

func (*Account) ProtoMessage()

func (*Account) ProtoReflect Uses

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

func (*Account) Reset Uses

func (x *Account) Reset()

func (*Account) String Uses

func (x *Account) String() string

type Client Uses

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

Client is a inbound handler for trojan protocol

func NewClient Uses

func NewClient(ctx context.Context, config *ClientConfig) (*Client, error)

NewClient create a new trojan client.

func (*Client) Process Uses

func (c *Client) Process(ctx context.Context, link *transport.Link, dialer internet.Dialer) error

Process implements OutboundHandler.Process().

type ClientConfig Uses

type ClientConfig struct {
    Server []*protocol.ServerEndpoint `protobuf:"bytes,1,rep,name=server,proto3" json:"server,omitempty"`
    // contains filtered or unexported fields
}

func (*ClientConfig) Descriptor Uses

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

Deprecated: Use ClientConfig.ProtoReflect.Descriptor instead.

func (*ClientConfig) GetServer Uses

func (x *ClientConfig) GetServer() []*protocol.ServerEndpoint

func (*ClientConfig) ProtoMessage Uses

func (*ClientConfig) ProtoMessage()

func (*ClientConfig) ProtoReflect Uses

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

func (*ClientConfig) Reset Uses

func (x *ClientConfig) Reset()

func (*ClientConfig) String Uses

func (x *ClientConfig) String() string

type ConnReader Uses

type ConnReader struct {
    io.Reader
    Target net.Destination
    // contains filtered or unexported fields
}

ConnReader is TCP Connection Reader Wrapper for trojan protocol

func (*ConnReader) ParseHeader Uses

func (c *ConnReader) ParseHeader() error

ParseHeader parses the trojan protocol header

func (*ConnReader) Read Uses

func (c *ConnReader) Read(p []byte) (int, error)

Read implements io.Reader

func (*ConnReader) ReadMultiBuffer Uses

func (c *ConnReader) ReadMultiBuffer() (buf.MultiBuffer, error)

ReadMultiBuffer implements buf.Reader

type ConnWriter Uses

type ConnWriter struct {
    io.Writer
    Target  net.Destination
    Account *MemoryAccount
    // contains filtered or unexported fields
}

ConnWriter is TCP Connection Writer Wrapper for trojan protocol

func (*ConnWriter) Write Uses

func (c *ConnWriter) Write(p []byte) (n int, err error)

Write implements io.Writer

func (*ConnWriter) WriteMultiBuffer Uses

func (c *ConnWriter) WriteMultiBuffer(mb buf.MultiBuffer) error

WriteMultiBuffer implements buf.Writer

type Fallback Uses

type Fallback struct {
    Alpn string `protobuf:"bytes,1,opt,name=alpn,proto3" json:"alpn,omitempty"`
    Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
    Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
    Dest string `protobuf:"bytes,4,opt,name=dest,proto3" json:"dest,omitempty"`
    Xver uint64 `protobuf:"varint,5,opt,name=xver,proto3" json:"xver,omitempty"`
    // contains filtered or unexported fields
}

func (*Fallback) Descriptor Uses

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

Deprecated: Use Fallback.ProtoReflect.Descriptor instead.

func (*Fallback) GetAlpn Uses

func (x *Fallback) GetAlpn() string

func (*Fallback) GetDest Uses

func (x *Fallback) GetDest() string

func (*Fallback) GetPath Uses

func (x *Fallback) GetPath() string

func (*Fallback) GetType Uses

func (x *Fallback) GetType() string

func (*Fallback) GetXver Uses

func (x *Fallback) GetXver() uint64

func (*Fallback) ProtoMessage Uses

func (*Fallback) ProtoMessage()

func (*Fallback) ProtoReflect Uses

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

func (*Fallback) Reset Uses

func (x *Fallback) Reset()

func (*Fallback) String Uses

func (x *Fallback) String() string

type MemoryAccount Uses

type MemoryAccount struct {
    Password string
    Key      []byte
}

MemoryAccount is an account type converted from Account.

func (*MemoryAccount) Equals Uses

func (a *MemoryAccount) Equals(another protocol.Account) bool

Equals implements protocol.Account.Equals().

type PacketPayload Uses

type PacketPayload struct {
    Target net.Destination
    Buffer buf.MultiBuffer
}

PacketPayload combines udp payload and destination

type PacketReader Uses

type PacketReader struct {
    io.Reader
}

PacketReader is UDP Connection Reader Wrapper for trojan protocol

func (*PacketReader) ReadMultiBuffer Uses

func (r *PacketReader) ReadMultiBuffer() (buf.MultiBuffer, error)

ReadMultiBuffer implements buf.Reader

func (*PacketReader) ReadMultiBufferWithMetadata Uses

func (r *PacketReader) ReadMultiBufferWithMetadata() (*PacketPayload, error)

ReadMultiBufferWithMetadata reads udp packet with destination

type PacketWriter Uses

type PacketWriter struct {
    io.Writer
    Target net.Destination
}

PacketWriter UDP Connection Writer Wrapper for trojan protocol

func (*PacketWriter) WriteMultiBuffer Uses

func (w *PacketWriter) WriteMultiBuffer(mb buf.MultiBuffer) error

WriteMultiBuffer implements buf.Writer

func (*PacketWriter) WriteMultiBufferWithMetadata Uses

func (w *PacketWriter) WriteMultiBufferWithMetadata(mb buf.MultiBuffer, dest net.Destination) error

WriteMultiBufferWithMetadata writes udp packet with destination specified

type Server Uses

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

Server is an inbound connection handler that handles messages in trojan protocol.

func NewServer Uses

func NewServer(ctx context.Context, config *ServerConfig) (*Server, error)

NewServer creates a new trojan inbound handler.

func (*Server) Network Uses

func (s *Server) Network() []net.Network

Network implements proxy.Inbound.Network().

func (*Server) Process Uses

func (s *Server) Process(ctx context.Context, network net.Network, conn internet.Connection, dispatcher routing.Dispatcher) error

Process implements proxy.Inbound.Process().

type ServerConfig Uses

type ServerConfig struct {
    Users     []*protocol.User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"`
    Fallbacks []*Fallback      `protobuf:"bytes,3,rep,name=fallbacks,proto3" json:"fallbacks,omitempty"`
    // contains filtered or unexported fields
}

func (*ServerConfig) Descriptor Uses

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

Deprecated: Use ServerConfig.ProtoReflect.Descriptor instead.

func (*ServerConfig) GetFallbacks Uses

func (x *ServerConfig) GetFallbacks() []*Fallback

func (*ServerConfig) GetUsers Uses

func (x *ServerConfig) GetUsers() []*protocol.User

func (*ServerConfig) ProtoMessage Uses

func (*ServerConfig) ProtoMessage()

func (*ServerConfig) ProtoReflect Uses

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

func (*ServerConfig) Reset Uses

func (x *ServerConfig) Reset()

func (*ServerConfig) String Uses

func (x *ServerConfig) String() string

type Validator Uses

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

Validator stores valid trojan users

func (*Validator) Add Uses

func (v *Validator) Add(u *protocol.MemoryUser) error

Add a trojan user

func (*Validator) Get Uses

func (v *Validator) Get(hash string) *protocol.MemoryUser

Get user with hashed key, nil if user doesn't exist.

Package trojan imports 32 packages (graph) and is imported by 4 packages. Updated 2020-10-16. Refresh now. Tools for package owners.