Documentation ¶
Index ¶
- Constants
- Variables
- func BinaryWrite(raw *bytes.Buffer, v ...string)
- func BytesToNum(b []byte) int
- func ChangeHostAndHeader(r *http.Request, host string, header string, addr string)
- func CheckAuth(r *http.Request, user, passwd string) bool
- func CopyBuffer(dst io.Writer, src io.Reader, label ...string) (written int64, err error)
- func DomainCheck(domain string) bool
- func FileExists(name string) bool
- func FormatAddress(s string) string
- func GeSynctMapLen(m sync.Map) int
- func GetAppPath() string
- func GetBoolByStr(s string) bool
- func GetBufPoolCopy() []byte
- func GetConfigPath() string
- func GetEnvMap() map[string]string
- func GetExtFromPath(path string) string
- func GetExternalIp() string
- func GetHostByName(hostname string) string
- func GetInstallPath() string
- func GetIntNoErrByStr(str string) int
- func GetIntranetIp() (error, string)
- func GetIpByAddr(addr string) string
- func GetLocalUdpAddr() (net.Conn, error)
- func GetLogMsg() string
- func GetLogPath() string
- func GetNpcLogPath() string
- func GetPortByAddr(addr string) int
- func GetPorts(p string) []int
- func GetRunPath() string
- func GetServerIpByClientIp(clientIp net.IP) string
- func GetStrByBool(b bool) string
- func GetTmpPath() string
- func GetWriteStr(v ...string) []byte
- func Getverifyval(vkey string) string
- func InIntArr(arr []int, val int) bool
- func InStrArr(arr []string, val string) bool
- func InitPProfFromArg(arg string)
- func InitPProfFromFile()
- func IsArrContains(arr []string, val string) bool
- func IsBlackIp(ipPort, vkey string, blackIpList []string) bool
- func IsPort(p string) bool
- func IsPublicIP(IP net.IP) bool
- func IsWindows() bool
- func ParseStr(str string) (string, error)
- func PrintVersion()
- func PutBufPoolCopy(buf []byte)
- func PutBufPoolMax(buf []byte)
- func PutBufPoolUdp(buf []byte)
- func ReadAllFromFile(filePath string) ([]byte, error)
- func RemoveArrVal(arr []string, val string) []string
- func TestTcpPort(port int) bool
- func TestUdpPort(port int) bool
- func TrimArr(arr []string) []string
- type Addr
- type NetPackager
- type StoreMsg
- type UDPDatagram
- type UDPHeader
Constants ¶
View Source
const ( CONN_DATA_SEQ = "*#*" //Separator VERIFY_EER = "vkey" VERIFY_SUCCESS = "sucs" WORK_MAIN = "main" WORK_CHAN = "chan" WORK_CONFIG = "conf" WORK_REGISTER = "rgst" WORK_SECRET = "sert" WORK_FILE = "file" WORK_P2P = "p2pm" WORK_P2P_VISITOR = "p2pv" WORK_P2P_PROVIDER = "p2pp" WORK_P2P_CONNECT = "p2pc" WORK_P2P_SUCCESS = "p2ps" WORK_P2P_END = "p2pe" WORK_P2P_LAST = "p2pl" WORK_STATUS = "stus" RES_MSG = "msg0" RES_CLOSE = "clse" NEW_UDP_CONN = "udpc" //p2p udp conn NEW_TASK = "task" NEW_CONF = "conf" NEW_HOST = "host" CONN_TCP = "tcp" CONN_UDP = "udp" CONN_TEST = "TST" Content-Type: text/plain; charset=utf-8 WWW-Authenticate: Basic realm="easyProxy" 401 Unauthorized` ConnectionFailBytes = `HTTP/1.1 404 Not Found ` )
View Source
const MaxMsgLen = 5000
View Source
const PoolSize = 64 * 1024
View Source
const PoolSizeCopy = 32 << 10
View Source
const PoolSizeSmall = 100
View Source
const PoolSizeUdp = 1472 + 200
Variables ¶
View Source
var BufPoolCopy = sync.Pool{ New: func() interface{} { return make([]byte, PoolSizeCopy) }, }
View Source
var BufPoolMax = sync.Pool{ New: func() interface{} { return make([]byte, PoolSize) }, }
View Source
var BufPoolSmall = sync.Pool{ New: func() interface{} { return make([]byte, PoolSizeSmall) }, }
View Source
var BufPoolUdp = sync.Pool{ New: func() interface{} { return make([]byte, PoolSizeUdp) }, }
View Source
var ConfPath string
View Source
var CopyBuff = copyBufferPool{}
Functions ¶
func BinaryWrite ¶
Write length and individual byte data Length prevents sticking # Characters are used to separate data
func ChangeHostAndHeader ¶
Change headers and host of request
func CopyBuffer ¶
func FileExists ¶
FileExists reports whether the named file or directory exists.
func GetBufPoolCopy ¶
func GetBufPoolCopy() []byte
func GetExtFromPath ¶
func GetExternalIp ¶
func GetExternalIp() string
func GetHostByName ¶
Get the corresponding IP address through domain name
func GetInstallPath ¶
func GetInstallPath() string
Different systems get different installation paths
func GetIntranetIp ¶
func GetLocalUdpAddr ¶
send this ip forget to get a local udp port
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 GetServerIpByClientIp ¶
func InitPProfFromArg ¶
func InitPProfFromArg(arg string)
func InitPProfFromFile ¶
func InitPProfFromFile()
func IsArrContains ¶
func IsPublicIP ¶
func PrintVersion ¶
func PrintVersion()
func PutBufPoolCopy ¶
func PutBufPoolCopy(buf []byte)
func PutBufPoolMax ¶
func PutBufPoolMax(buf []byte)
func PutBufPoolUdp ¶
func PutBufPoolUdp(buf []byte)
func ReadAllFromFile ¶
Read file content by file path
func RemoveArrVal ¶
remove value from string array
Types ¶
type Addr ¶
func ToSocksAddr ¶
type NetPackager ¶
type UDPDatagram ¶
func NewUDPDatagram ¶
func NewUDPDatagram(header *UDPHeader, data []byte) *UDPDatagram
func ReadUDPDatagram ¶
func ReadUDPDatagram(r io.Reader) (*UDPDatagram, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.