Code optimization

This commit is contained in:
刘河
2019-03-23 22:19:59 +08:00
parent efa341c7e8
commit b189fb1b6e
260 changed files with 50746 additions and 851 deletions

View File

@@ -13,8 +13,10 @@ import (
"net/http"
"os"
"regexp"
"sort"
"strconv"
"strings"
"sync"
)
//Get the corresponding IP address through domain name
@@ -344,3 +346,12 @@ func BytesToNum(b []byte) int {
x, _ := strconv.Atoi(str)
return int(x)
}
func GetMapKeys(m sync.Map) (keys []int) {
m.Range(func(key, value interface{}) bool {
keys = append(keys, key.(int))
return true
})
sort.Ints(keys)
return
}