Documentation ¶
Index ¶
- Constants
- Variables
- func Check(conn net.Conn, user *User) (err error)
- func Copy2(conn net.Conn, rc net.PacketConn, timeout time.Duration, ch chan data)
- func Handle(conn net.Conn, user *User) error
- func HandleConn(conn net.Conn, user *User) (err error)
- func HandleMux(conn net.Conn, user *User) (err error)
- func HandleStream(conn net.Conn, user *User) (err error)
- func HandleTCP(conn net.Conn, addr string) (n1 int64, n2 int64, err error)
- func HandleUDP(conn net.Conn) (int64, int64, error)
- func ResolveUDPAddr(addr Addr) (*net.UDPAddr, error)
- type Addr
- type Middleware
- func (Middleware) CaddyModule() caddy.ModuleInfo
- func (m *Middleware) Cleanup() error
- func (m Middleware) HandleAdmin(w http.ResponseWriter, r *http.Request) error
- func (m *Middleware) Provision(ctx caddy.Context) error
- func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
- func (m *Middleware) Validate() error
- type Reader
- type User
- type Users
- func (users *Users) Delete(key string)
- func (users *Users) Destroy()
- func (users *Users) HandleAdmin(w http.ResponseWriter, r *http.Request)
- func (users *Users) Load(key string) (user *User, ok bool)
- func (users *Users) Range() chan *User
- func (users *Users) Store(key string, user *User)
- func (users *Users) UserNum() int
- type WebConn
Constants ¶
View Source
const ( AddrTypeIPv4 = 1 AddrTypeDomain = 3 AddrTypeIPv6 = 4 )
View Source
const ( HexLen = 56 MaxBufferSize = 1024 * 32 )
View Source
const ( Connect = 1 Assocaite = 3 SMUX = 0x7f )
View Source
const MaxAddrLen = 1 + 1 + 255 + 2
Variables ¶
View Source
var ( ErrNoQuota = fmt.Errorf("no quota") ErrNotTrojan = fmt.Errorf("not trojan connection") )
View Source
var ErrInvalidAddrType = errors.New("invalid address type")
Functions ¶
Types ¶
type Middleware ¶
type Middleware struct { // information about trojan users Admin []string `json:"admin"` Method string `json:"method,omitempty"` Password string `json:"password"` Users []*User `json:"users"` *zap.Logger Upgrader *websocket.Upgrader Server http.Server Cipher core.Cipher // contains filtered or unexported fields }
Middleware implements an HTTP handler that ...
func (Middleware) CaddyModule ¶
func (Middleware) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*Middleware) Cleanup ¶
func (m *Middleware) Cleanup() error
Cleanup implements caddy.CleanerUpper.
func (Middleware) HandleAdmin ¶
func (m Middleware) HandleAdmin(w http.ResponseWriter, r *http.Request) error
Admin implements http.HandlerFunc.
func (*Middleware) Provision ¶
func (m *Middleware) Provision(ctx caddy.Context) error
Provision implements caddy.Provisioner.
func (Middleware) ServeHTTP ¶
func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
ServeHTTP implements caddyhttp.MiddlewareHandler.
func (*Middleware) Validate ¶
func (m *Middleware) Validate() error
Validate implements caddy.Validator.
type User ¶
type Users ¶
func (*Users) HandleAdmin ¶
func (users *Users) HandleAdmin(w http.ResponseWriter, r *http.Request)
type WebConn ¶
func NewWebConn ¶
Click to show internal directories.
Click to hide internal directories.