mirror of
https://github.com/ehang-io/nps.git
synced 2026-11-01 01:02:12 +08:00
Code optimization
This commit is contained in:
1 parent
efa341c7e8
commit
b189fb1b6e
260 files changed
+50746
-851
No files matched your search
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user