mirror of
https://github.com/joohoi/acme-dns.git
synced 2025-07-18 03:37:55 +07:00
Added config option to check for a header value for clinet IP
This commit is contained in:
18
util.go
18
util.go
@ -2,12 +2,13 @@ package main
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"github.com/BurntSushi/toml"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/miekg/dns"
|
||||
"math/big"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
func readConfig(fname string) DNSConfig {
|
||||
@ -68,3 +69,14 @@ func startDNS(listen string, proto string) *dns.Server {
|
||||
go server.ListenAndServe()
|
||||
return server
|
||||
}
|
||||
|
||||
func getIPListFromHeader(header string) []string {
|
||||
iplist := []string{}
|
||||
for _, v := range strings.Split(header, ",") {
|
||||
if len(v) > 0 {
|
||||
// Ignore empty values
|
||||
iplist = append(iplist, strings.TrimSpace(v))
|
||||
}
|
||||
}
|
||||
return iplist
|
||||
}
|
||||
|
Reference in New Issue
Block a user