http

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server socks5 server

func NewServer

func NewServer(cfg ServerConf, addr string) *Server

NewServer create server

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe listen and serve

func (*Server) ListenAndServeTLS

func (s *Server) ListenAndServeTLS() error

ListenAndServeTLS listen and serve tls

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown service shutdown

type ServerConf

type ServerConf struct {
	ReadTimeout  time.Duration // Default: 1s
	WriteTimeout time.Duration // Default: 1s
	Check        bool          // Default: false
	Key          string
	Crt          string
	Handler      ServerHandler
}

ServerConf server config

func (*ServerConf) SetDefault

func (cfg *ServerConf) SetDefault()

SetDefault check and set default value

type ServerHandler

type ServerHandler interface {
	LogDebug(format string, a ...interface{})
	LogError(format string, a ...interface{})
	LogInfo(format string, a ...interface{})
	CheckUserPass(user, pass string) bool
	Connect(a addr.Addr) (io.ReadWriteCloser, addr.Addr, error)
	Forward(local, remote io.ReadWriteCloser)
}

ServerHandler server handler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL