server

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const BrowserWarningCookieName = "tunl-online-skip-warning"
View Source
const BrowserWarningHeaderName = "Tunl-Online-Skip-Warning"
View Source
const BrowserWarningNoScriptText = "" /* 178-byte string literal not displayed */
View Source
const DefaultNoScriptText = "You need to enable JavaScript to run this app."

Variables

View Source
var ClientMinimumVersion = "1.0.0"
View Source
var ErrorIdBusy = errors.New("connection id is busy")
View Source
var Version = "1.0.0"

Functions

func CheckClientUp added in v1.0.0

func CheckClientUp(ver string) bool

func CheckUpdates added in v1.0.0

func CheckUpdates() *gover.Version

Types

type AppMessage added in v1.0.0

type AppMessage struct {
	Title        string
	Data         string
	NoScriptText string
}

type Config

type Config struct {
	Server *Server `yaml:"server"`
	Tunl   *Tunl   `yaml:"tunl"`
	Log    *Log    `yaml:"log"`
}

func LoadConfig

func LoadConfig() (*Config, error)

type Connection added in v1.0.0

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

func (*Connection) Close added in v1.0.0

func (c *Connection) Close()

func (*Connection) Conn added in v1.0.0

func (c *Connection) Conn() *tunl.TunlConn

func (*Connection) GetHost added in v1.0.0

func (c *Connection) GetHost() string

func (*Connection) GetID added in v1.0.0

func (c *Connection) GetID() string

func (*Connection) GetRemoteIP added in v1.0.0

func (c *Connection) GetRemoteIP() string

func (*Connection) IsAllowed added in v1.0.0

func (c *Connection) IsAllowed() bool

func (*Connection) SetAllowed added in v1.0.0

func (c *Connection) SetAllowed(allow bool)

func (*Connection) SetHost added in v1.0.0

func (c *Connection) SetHost(host string)

type ConnectionPool

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

func NewConnectionPool

func NewConnectionPool(prefixSize int) *ConnectionPool

func (*ConnectionPool) CloseChannels

func (p *ConnectionPool) CloseChannels(uuid string)

func (*ConnectionPool) Count

func (p *ConnectionPool) Count() int

func (*ConnectionPool) Drop

func (p *ConnectionPool) Drop(id string)

func (*ConnectionPool) Get

func (p *ConnectionPool) Get(id string) *Connection

func (*ConnectionPool) GetBodyChunkChan

func (p *ConnectionPool) GetBodyChunkChan(uuid string) chan *commands.BodyChunk

func (*ConnectionPool) GetResponseChan

func (p *ConnectionPool) GetResponseChan(uuid string) chan *commands.HttpResponse

func (*ConnectionPool) MakeBodyChunkChan

func (p *ConnectionPool) MakeBodyChunkChan(uuid string) chan *commands.BodyChunk

func (*ConnectionPool) MakeResponseChan

func (p *ConnectionPool) MakeResponseChan(uuid string) chan *commands.HttpResponse

func (*ConnectionPool) Push

func (p *ConnectionPool) Push(conn *tunl.TunlConn) error

type ErrorCode added in v1.0.0

type ErrorCode int
const (
	ErrorBrowserWarning ErrorCode = 1000 + iota
	ErrorUndefinedClient
	ErrorConnectClient
	ErrorReceiveData
)

type JsonData

type JsonData map[string]interface{}

type Log added in v1.0.0

type Log struct {
	Enabled  bool   `yaml:"enabled"`
	LogDir   string `yaml:"log_dir"`
	LogDaily bool   `yaml:"log_daily"`
}

type Server added in v1.0.0

type Server struct {
	HTTPAddr    string `yaml:"http_addr"`
	HTTPPort    string `yaml:"http_port"`
	KeyFile     string `yaml:"key_file"`
	CertFile    string `yaml:"cert_file"`
	IdleTimeout int    `yaml:"idle_timeout"`
	ReadTimeout int    `yaml:"read_timeout"`
	ThreadCount int    `yaml:"thread_count"`
	KeepAlive   bool   `yaml:"keep_alive"`
	SSL         bool   `yaml:"user_ssl"`
	Debug       bool   `yaml:"debug"`
}

type Tunl added in v1.0.0

type Tunl struct {
	Addr           string `yaml:"addr"`
	Port           string `yaml:"port"`
	Domain         string `yaml:"domain"`
	SchemeHttps    bool   `yaml:"scheme_https"`
	MaxClients     int    `yaml:"max_clients"`
	MaxTimeout     int    `yaml:"max_timeout"`
	MaxPostSize    int    `yaml:"max_post_size"`
	ClientExpireAt int    `yaml:"client_expire_at"`
	UriPrefixSize  int    `yaml:"uri_prefix_size"`
	ServerPrivate  bool   `yaml:"server_private"`
	ServerPassword string `yaml:"server_password"`
	BrowserWarning bool   `yaml:"browser_warning"`
}

type TunlHttp

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

func NewTunlHttp

func NewTunlHttp(conf *Config, log *golog.Logger, ctx context.Context) *TunlHttp

func (*TunlHttp) Shutdown

func (s *TunlHttp) Shutdown()

func (*TunlHttp) Start

func (s *TunlHttp) Start()

type TunlServer

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

func NewTunlServer

func NewTunlServer(conf *Tunl, log *golog.Logger) *TunlServer

func (*TunlServer) GetPool

func (s *TunlServer) GetPool() *ConnectionPool

func (*TunlServer) Run

func (s *TunlServer) Run(conf *Config) error

func (*TunlServer) Start

func (s *TunlServer) Start(conf Config) error

Jump to

Keyboard shortcuts

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