app

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCfg = &Config{
	ApollgoPort:  8888,
	EnableGlider: true,
	Listeners: []network.ListenerConfig{
		network.ListenerConfig{
			URIs:          []string{"socks5://:3080"},
			Strategy:      "rr",
			Check:         "https://google.com",
			CheckInterval: 300,
			Forwarders:    []string{},
			MaxFailures:   3,
			DialTimeout:   3,
			RelayTimeout:  0,
			IntFace:       "",
			DNSListener:   "",
			DNSAlwaysTCP:  false,
			DNSServers:    []string{"8.8.8.8:53"},
			DNSMaxTTL:     1800,
			DNSMinTTL:     0,
			DNSTimeout:    3,
			DNSCacheSize:  4096,
			DNSRecords:    []string{},
		},
	},
	EnableHermes: false,
	HermesConfig: network.HermesConfig{
		Password:     "",
		HermesPort:   4000,
		Server:       "127.0.0.1",
		ForwardPairs: []string{"8888/80"},
	},
}

DefaultCfg default config

Functions

func OnAppLaunch

func OnAppLaunch(app app.App)

OnAppLaunch handles app launch and event loop

Types

type ApollgoApp

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

ApollgoApp is global app state

func NewApollgoApp

func NewApollgoApp(cfgFn string) *ApollgoApp

NewApollgoApp creates default state

func (*ApollgoApp) GetCfg

func (s *ApollgoApp) GetCfg() *Config

GetCfg gets config

func (*ApollgoApp) GetStatus

func (s *ApollgoApp) GetStatus() *Status

GetStatus gets status

func (*ApollgoApp) Log

func (s *ApollgoApp) Log(val string)

Log logs something

func (*ApollgoApp) Run

func (s *ApollgoApp) Run()

Run starts misc tasks

func (*ApollgoApp) SetCfg

func (s *ApollgoApp) SetCfg(newCfg *Config)

SetCfg updates config

type Config

type Config struct {
	Listeners    []network.ListenerConfig `json:"listeners"`
	ApollgoPort  int                      `json:"apollgoPort"`
	EnableGlider bool                     `json:"enableGlider"`
	EnableHermes bool                     `json:"enableHermes"`
	HermesConfig network.HermesConfig     `json:"hermesConfig"`
}

Config server config

type LogLine

type LogLine struct {
	Text string `json:"text"`
	Time int64  `json:"time"`
}

LogLine is a single log

type Status

type Status struct {
	IP      string    `json:"ip"`
	DLSpeed float64   `json:"dlSpeed"`
	ULSpeed float64   `json:"ulSpeed"`
	Latency float64   `json:"latency"`
	Logs    []LogLine `json:"logs"`
}

Status is app status

Jump to

Keyboard shortcuts

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