common

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COMPRESS_NONE_ENCODE = iota
	COMPRESS_NONE_DECODE
	COMPRESS_SNAPY_ENCODE
	COMPRESS_SNAPY_DECODE
	VERIFY_EER        = "vkey"
	WORK_MAIN         = "main"
	WORK_CHAN         = "chan"
	RES_SIGN          = "sign"
	RES_MSG           = "msg0"
	RES_CLOSE         = "clse"
	NEW_CONN          = "conn" //新连接标志
	NEW_TASK          = "task" //新连接标志
	CONN_SUCCESS      = "sucs"
	CONN_TCP          = "tcp"
	CONN_UDP          = "udp"
	UnauthorizedBytes = `HTTP/1.1 401 Unauthorized
Content-Type: text/plain; charset=utf-8
WWW-Authenticate: Basic realm="easyProxy"

401 Unauthorized`
	IO_EOF              = "PROXYEOF"
	ConnectionFailBytes = `HTTP/1.1 404 Not Found

`
)

Variables

This section is empty.

Functions

func BinaryWrite

func BinaryWrite(raw *bytes.Buffer, v ...string)

Write length and individual byte data Length prevents sticking # Characters are used to separate data

func ChangeHostAndHeader

func ChangeHostAndHeader(r *http.Request, host string, header string, addr string)

Change headers and host of request

func CheckAuth

func CheckAuth(r *http.Request, user, passwd string) bool

Check if the Request request is validated

func DomainCheck

func DomainCheck(domain string) bool

Check the legality of domain

func FileExists

func FileExists(name string) bool

FileExists reports whether the named file or directory exists.

func GetAppPath

func GetAppPath() string

Get the absolute path to the running directory

func GetBoolByStr

func GetBoolByStr(s string) bool

get bool by str

func GetCompressType

func GetCompressType(compress string) (int, int)

Judging Compression Mode

func GetHostByName

func GetHostByName(hostname string) string

Get the corresponding IP address through domain name

func GetInstallPath

func GetInstallPath() string

Different systems get different installation paths

func GetIntNoErrByStr

func GetIntNoErrByStr(str string) int

int

func GetLogPath

func GetLogPath() string

interface log file path

func GetPidPath

func GetPidPath() string

interface pid file path

func GetRunPath

func GetRunPath() string

Get the currently selected configuration file directory For non-Windows systems, select the /etc/nps as config directory if exist, or select ./ windows system, select the C:\Program Files\nps as config directory if exist, or select ./

func GetStrByBool

func GetStrByBool(b bool) string

get str by bool

func Getverifyval

func Getverifyval(vkey string) string

Get verify value

func IsWindows

func IsWindows() bool

Determine whether the current system is a Windows system?

func ReadAllFromFile

func ReadAllFromFile(filePath string) ([]byte, error)

Read file content by file path

func TestTcpPort

func TestTcpPort(port int) bool

Judge whether the TCP port can open normally

func TestUdpPort

func TestUdpPort(port int) bool

Judge whether the UDP port can open normally

Types

This section is empty.

Jump to

Keyboard shortcuts

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