mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-02 03:16:53 +00:00
Code optimization
This commit is contained in:
@@ -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