common

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AdminExpirationTime = time.Date(2900, 1, 1, 0, 0, 0, 0, time.UTC)

Functions

func CheckConnectivity

func CheckConnectivity(ip string, port int)

CheckConnectivity checks the connectivity to the server via it's public ExternalIP and port.

func CheckSingBoxInstalled

func CheckSingBoxInstalled() bool

func GenerateBasicSingBoxServerConfig

func GenerateBasicSingBoxServerConfig(dataDir string) (*option.Options, error)

func GenerateSingBoxConnectConfig

func GenerateSingBoxConnectConfig(dataDir, publicIP, username string) ([]byte, error)

func GetPublicIP

func GetPublicIP() (string, error)

GetPublicIP fetches the public ExternalIP address of the server by trying a list of known services.

func GetShadowsocksInboundConfig

func GetShadowsocksInboundConfig(singBoxServerConfig *option.Options) (*option.ShadowsocksInboundOptions, error)

func ReadSingBoxServerConfig

func ReadSingBoxServerConfig(dataDir string) (*option.Options, error)

func RestartSingBox

func RestartSingBox(dataDir string) error

func RevokeUser

func RevokeUser(dataDir, username string) error

func ValidateSingBoxConfig added in v0.0.3

func ValidateSingBoxConfig(dataDir string) error

func WriteSingBoxServerConfig

func WriteSingBoxServerConfig(dataDir string, opt *option.Options) error

Types

type ServerConfig

type ServerConfig struct {
	ExternalIP  string `json:"external_ip"`
	Port        int    `json:"port"`
	AccessToken string `json:"access_token"`
	HMACSecret  []byte `json:"hmac_secret"`
}

func GenerateServerConfig

func GenerateServerConfig(dataDir string) (*ServerConfig, error)

func ReadServerConfig

func ReadServerConfig(dataDir string) (*ServerConfig, error)

func (*ServerConfig) GetNewServerURL

func (c *ServerConfig) GetNewServerURL() string

func (*ServerConfig) GetQR

func (c *ServerConfig) GetQR() string

Jump to

Keyboard shortcuts

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