core

package
Version: v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2020 License: MIT Imports: 54 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusOpened         = uint8(0x0)
	StatusMethodAccepted = uint8(0x1)
	StatusAccepted       = uint8(0x2)
)
View Source
const SO_ORIGINAL_DST = 80

Variables

View Source
var IsMobile bool

Functions

func GetDstAddrFromRequest

func GetDstAddrFromRequest(request socks5.Request) (net.Addr, error)

func GetESNI

func GetESNI(domain string) (*tls.ESNIKeys, error)

func GetURI

func GetURI(addr net.Addr) string

Types

type Client

type Client struct {
	fx.Lifecycle
	*gnet.EventServer

	*config.ConfigGo
	*goroutine.Pool
	// contains filtered or unexported fields
}

func NewClient

func NewClient(lc fx.Lifecycle, conf *config.ConfigGo, pool *goroutine.Pool, router *Router) *Client

func (*Client) HandleMethodRequest

func (client *Client) HandleMethodRequest(data []byte) (b []byte, action gnet.Action)

func (*Client) OnClosed

func (client *Client) OnClosed(c gnet.Conn, err error) (action gnet.Action)

func (*Client) OnInitComplete

func (client *Client) OnInitComplete(svr gnet.Server) (action gnet.Action)

func (*Client) OnOpened

func (client *Client) OnOpened(c gnet.Conn) (out []byte, action gnet.Action)

func (*Client) OnShutdown

func (client *Client) OnShutdown(svr gnet.Server)

func (*Client) React

func (client *Client) React(frame []byte, c gnet.Conn) (out []byte, action gnet.Action)

func (*Client) Run

func (client *Client) Run() error

type Conn

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

func NewConn

func NewConn(gnetConn gnet.Conn, clientConf *config.ClientGo) *Conn

func (*Conn) DialWs

func (conn *Conn) DialWs(request socks5.Request) (http.Header, error)

func (*Conn) DirectConnect

func (conn *Conn) DirectConnect()

func (*Conn) Run

func (conn *Conn) Run()

type HTTPServer

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

func (*HTTPServer) Serve

func (server *HTTPServer) Serve() error

type Map

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

func NewMap

func NewMap() *Map

func (*Map) Delete

func (m *Map) Delete(key string)

func (*Map) Get

func (m *Map) Get(key string) (*Conn, bool)

func (*Map) Put

func (m *Map) Put(conn *Conn)

type RateLimiter

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

func NewRateLimiter

func NewRateLimiter(bandwidth uint) *RateLimiter

func (*RateLimiter) Available

func (rateLimiter *RateLimiter) Available() uint64

func (*RateLimiter) Capacity

func (rateLimiter *RateLimiter) Capacity() uint64

func (*RateLimiter) Run

func (rateLimiter *RateLimiter) Run()

func (*RateLimiter) Wait

func (rateLimiter *RateLimiter) Wait(tokens uint) error

type RedirServer

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

func (*RedirServer) Run

func (server *RedirServer) Run()

type Router

type Router struct {
	GeoIPDB *geoip2.Reader
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(conf *config.ConfigGo) (*Router, error)

func (*Router) Download

func (router *Router) Download() error

func (*Router) RemoveCache

func (router *Router) RemoveCache(ip net.IP)

func (*Router) Select

func (router *Router) Select(ip net.IP) bool

func (*Router) SwitchOff

func (router *Router) SwitchOff()

func (*Router) SwitchOn

func (router *Router) SwitchOn()

func (*Router) Update

func (router *Router) Update() error

type Server

type Server struct {
	fx.Lifecycle
	net.Listener
	*config.ConfigGo
	*hashmap.Map
	// contains filtered or unexported fields
}

func NewServer

func NewServer(lc fx.Lifecycle, conf *config.ConfigGo) *Server

func (*Server) Authenticate

func (server *Server) Authenticate(ctx *fasthttp.RequestCtx) bool

func (*Server) DeleteConfig

func (server *Server) DeleteConfig(c *gin.Context)

func (*Server) DeleteLog

func (server *Server) DeleteLog(c *gin.Context)

func (*Server) DeleteMeta

func (server *Server) DeleteMeta(c *gin.Context)

func (*Server) DeleteNotice

func (server *Server) DeleteNotice(c *gin.Context)

func (*Server) DeletePlan

func (server *Server) DeletePlan(c *gin.Context)

func (*Server) DeleteSession

func (server *Server) DeleteSession(c *gin.Context)

func (*Server) DeleteUser

func (server *Server) DeleteUser(c *gin.Context)

func (*Server) GetBucket

func (server *Server) GetBucket(username string) (*RateLimiter, error)

func (*Server) GetCaptcha

func (server *Server) GetCaptcha(c *gin.Context)

func (*Server) GetConfig

func (server *Server) GetConfig(c *gin.Context)

func (*Server) GetLogList

func (server *Server) GetLogList(c *gin.Context)

func (*Server) GetLogOne

func (server *Server) GetLogOne(c *gin.Context)

func (*Server) GetMeta

func (server *Server) GetMeta(c *gin.Context)

func (*Server) GetNotice

func (server *Server) GetNotice(c *gin.Context)

func (*Server) GetNoticeOne

func (server *Server) GetNoticeOne(c *gin.Context)

func (*Server) GetPlan

func (server *Server) GetPlan(c *gin.Context)

func (*Server) GetPlanOne

func (server *Server) GetPlanOne(c *gin.Context)

func (*Server) GetRole

func (server *Server) GetRole(c *gin.Context) (uint, error)

func (*Server) GetSession

func (server *Server) GetSession(c *gin.Context)

func (*Server) GetUser

func (server *Server) GetUser(c *gin.Context)

func (*Server) GetUserList

func (server *Server) GetUserList(c *gin.Context)

func (*Server) GetUserOne

func (server *Server) GetUserOne(c *gin.Context)

func (*Server) PostConfig

func (server *Server) PostConfig(c *gin.Context)

func (*Server) PostLog

func (server *Server) PostLog(c *gin.Context)

func (*Server) PostMeta

func (server *Server) PostMeta(c *gin.Context)

func (*Server) PostNotice

func (server *Server) PostNotice(c *gin.Context)

func (*Server) PostPlan

func (server *Server) PostPlan(c *gin.Context)

func (*Server) PostSession

func (server *Server) PostSession(c *gin.Context)

login

func (*Server) PostUser

func (server *Server) PostUser(c *gin.Context)

register

func (*Server) PutConfig

func (server *Server) PutConfig(c *gin.Context)

func (*Server) PutLog

func (server *Server) PutLog(c *gin.Context)

func (*Server) PutMeta

func (server *Server) PutMeta(c *gin.Context)

func (*Server) PutNotice

func (server *Server) PutNotice(c *gin.Context)

func (*Server) PutPlan

func (server *Server) PutPlan(c *gin.Context)

func (*Server) PutSession

func (server *Server) PutSession(c *gin.Context)

func (*Server) PutUser

func (server *Server) PutUser(c *gin.Context)

func (*Server) Run

func (server *Server) Run()

func (*Server) ServeRoot

func (server *Server) ServeRoot(c *gin.Context)

type TCPSegmentConn

type TCPSegmentConn struct {
	*net.TCPConn
	// contains filtered or unexported fields
}

func (*TCPSegmentConn) Write

func (conn *TCPSegmentConn) Write(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL