Öffentliche Dateiansicht: Raw-Dateien, Tree, Releases und Issues sind ohne Login verfügbar.
security/Whitelist.go
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package security

import (
	"github.com/adrian-lorenz/noxway/global"
	"github.com/adrian-lorenz/noxway/tools"
	"slices"
)

func CheckWhitelists(ip string) bool {
	if ip == "" {
		return false
	}
	if len(global.Config.SystemWhitelist) > 0 {
		if slices.Contains(global.Config.SystemWhitelist, ip) {
			return true
		}
	}
	if len(global.Config.SystemWhitelistDNS) > 0 {
		for _, w := range global.Config.SystemWhitelistDNS {
			dnsIp, err := tools.GetDnsIPWithResolver(w, global.Config.DNSResolver)
			if err != nil {
				return false
			}
			if dnsIp == ip {
				return true
			}
		}
	}
	return false
}
Sprachen
Go 46%
JavaScript 45%
Markdown 3.3%
HTML 2.5%
YAML 1.7%
JSON 1.1%
Klonen
HTTPS