redo web UI |web close| client log |system info |p2p |max、ump optimization

This commit is contained in:
刘河
2019-03-01 17:23:14 +08:00
parent 534d428c6d
commit f526c56784
82 changed files with 15199 additions and 4561 deletions

View File

@@ -16,19 +16,6 @@ import (
"strings"
)
//Judging Compression Mode
func GetCompressType(compress string) (int, int) {
switch compress {
case "":
return COMPRESS_NONE_DECODE, COMPRESS_NONE_ENCODE
case "snappy":
return COMPRESS_SNAPY_DECODE, COMPRESS_SNAPY_ENCODE
default:
return COMPRESS_NONE_DECODE, COMPRESS_NONE_ENCODE
}
return COMPRESS_NONE_DECODE, COMPRESS_NONE_ENCODE
}
//Get the corresponding IP address through domain name
func GetHostByName(hostname string) string {
if !DomainCheck(hostname) {
@@ -185,6 +172,7 @@ func BinaryWrite(raw *bytes.Buffer, v ...string) {
binary.Write(raw, binary.LittleEndian, buffer.Bytes())
}
//inArray str interface
func InStrArr(arr []string, val string) bool {
for _, v := range arr {
if v == val {
@@ -194,6 +182,7 @@ func InStrArr(arr []string, val string) bool {
return false
}
//inArray int interface
func InIntArr(arr []int, val int) bool {
for _, v := range arr {
if v == val {
@@ -203,6 +192,7 @@ func InIntArr(arr []int, val int) bool {
return false
}
//format ports str to a int array
func GetPorts(p string) []int {
var ps []int
arr := strings.Split(p, ",")
@@ -277,3 +267,12 @@ func CopyBuffer(dst io.Writer, src io.Reader) (written int64, err error) {
defer pool.PutBufPoolCopy(buf)
return written, err
}
//send this ip forget to get a local udp port
func GetLocalUdpAddr() (net.Conn, error) {
tmpConn, err := net.Dial("udp", "114.114.114.114:53")
if err != nil {
return nil, err
}
return tmpConn, tmpConn.Close()
}