import "v2ray.com/core/proxy/trojan"
client.go config.go config.pb.go errors.generated.go protocol.go server.go trojan.go validator.go
var File_proxy_trojan_config_proto protoreflect.FileDescriptor
type Account struct { Password string `protobuf:"bytes,1,opt,name=password,proto3" json:"password,omitempty"` // contains filtered or unexported fields }
AsAccount implements protocol.AsAccount.
Deprecated: Use Account.ProtoReflect.Descriptor instead.
func (x *Account) ProtoReflect() protoreflect.Message
type Client struct {
// contains filtered or unexported fields
}
Client is a inbound handler for trojan protocol
NewClient create a new trojan client.
Process implements OutboundHandler.Process().
type ClientConfig struct { Server []*protocol.ServerEndpoint `protobuf:"bytes,1,rep,name=server,proto3" json:"server,omitempty"` // contains filtered or unexported fields }
func (*ClientConfig) Descriptor() ([]byte, []int)
Deprecated: Use ClientConfig.ProtoReflect.Descriptor instead.
func (x *ClientConfig) GetServer() []*protocol.ServerEndpoint
func (*ClientConfig) ProtoMessage()
func (x *ClientConfig) ProtoReflect() protoreflect.Message
func (x *ClientConfig) Reset()
func (x *ClientConfig) String() string
type ConnReader struct { io.Reader Target net.Destination // contains filtered or unexported fields }
ConnReader is TCP Connection Reader Wrapper for trojan protocol
func (c *ConnReader) ParseHeader() error
ParseHeader parses the trojan protocol header
func (c *ConnReader) Read(p []byte) (int, error)
Read implements io.Reader
func (c *ConnReader) ReadMultiBuffer() (buf.MultiBuffer, error)
ReadMultiBuffer implements buf.Reader
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 (c *ConnWriter) Write(p []byte) (n int, err error)
Write implements io.Writer
func (c *ConnWriter) WriteMultiBuffer(mb buf.MultiBuffer) error
WriteMultiBuffer implements buf.Writer
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 }
Deprecated: Use Fallback.ProtoReflect.Descriptor instead.
func (x *Fallback) ProtoReflect() protoreflect.Message
MemoryAccount is an account type converted from Account.
func (a *MemoryAccount) Equals(another protocol.Account) bool
Equals implements protocol.Account.Equals().
type PacketPayload struct { Target net.Destination Buffer buf.MultiBuffer }
PacketPayload combines udp payload and destination
PacketReader is UDP Connection Reader Wrapper for trojan protocol
func (r *PacketReader) ReadMultiBuffer() (buf.MultiBuffer, error)
ReadMultiBuffer implements buf.Reader
func (r *PacketReader) ReadMultiBufferWithMetadata() (*PacketPayload, error)
ReadMultiBufferWithMetadata reads udp packet with destination
type PacketWriter struct { io.Writer Target net.Destination }
PacketWriter UDP Connection Writer Wrapper for trojan protocol
func (w *PacketWriter) WriteMultiBuffer(mb buf.MultiBuffer) error
WriteMultiBuffer implements buf.Writer
func (w *PacketWriter) WriteMultiBufferWithMetadata(mb buf.MultiBuffer, dest net.Destination) error
WriteMultiBufferWithMetadata writes udp packet with destination specified
type Server struct {
// contains filtered or unexported fields
}
Server is an inbound connection handler that handles messages in trojan protocol.
NewServer creates a new trojan inbound handler.
Network implements proxy.Inbound.Network().
func (s *Server) Process(ctx context.Context, network net.Network, conn internet.Connection, dispatcher routing.Dispatcher) error
Process implements proxy.Inbound.Process().
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() ([]byte, []int)
Deprecated: Use ServerConfig.ProtoReflect.Descriptor instead.
func (x *ServerConfig) GetFallbacks() []*Fallback
func (x *ServerConfig) GetUsers() []*protocol.User
func (*ServerConfig) ProtoMessage()
func (x *ServerConfig) ProtoReflect() protoreflect.Message
func (x *ServerConfig) Reset()
func (x *ServerConfig) String() string
type Validator struct {
// contains filtered or unexported fields
}
Validator stores valid trojan users
func (v *Validator) Add(u *protocol.MemoryUser) error
Add a trojan user
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.