refactor: ddns (#414)

* refactor ddns

* update webhook
This commit is contained in:
UUBulb
2024-08-24 11:11:06 +08:00
committed by GitHub
parent 64da3c7438
commit eb6dd2855e
17 changed files with 523 additions and 352 deletions

View File

@@ -3,6 +3,7 @@ package utils
import (
"crypto/rand"
"math/big"
"net/http"
"os"
"regexp"
"strings"
@@ -86,3 +87,15 @@ func Uint64SubInt64(a uint64, b int64) uint64 {
}
return a - uint64(b)
}
func SetStringHeadersToRequest(req *http.Request, headers []string) {
if req == nil {
return
}
for _, element := range headers {
kv := strings.SplitN(element, ":", 2)
if len(kv) == 2 {
req.Header.Add(kv[0], kv[1])
}
}
}