mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-08-20 08:11:46 +00:00
Implement client side ACL for SOCKS5 TCP
This commit is contained in:
@@ -25,13 +25,10 @@ type Entry struct {
|
||||
ActionArg string
|
||||
}
|
||||
|
||||
func (e Entry) Match(domain string, ip net.IP) bool {
|
||||
func (e Entry) MatchDomain(domain string) bool {
|
||||
if e.All {
|
||||
return true
|
||||
}
|
||||
if e.Net != nil && ip != nil {
|
||||
return e.Net.Contains(ip)
|
||||
}
|
||||
if len(e.Domain) > 0 && len(domain) > 0 {
|
||||
ld := strings.ToLower(domain)
|
||||
if e.Suffix {
|
||||
@@ -43,6 +40,30 @@ func (e Entry) Match(domain string, ip net.IP) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (e Entry) MatchIP(ip net.IP) bool {
|
||||
if e.All {
|
||||
return true
|
||||
}
|
||||
if e.Net != nil && ip != nil {
|
||||
return e.Net.Contains(ip)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (e Entry) MatchIPs(ips []net.IP) bool {
|
||||
if e.All {
|
||||
return true
|
||||
}
|
||||
if e.Net != nil && len(ips) > 0 {
|
||||
for _, ip := range ips {
|
||||
if e.Net.Contains(ip) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Format: action cond_type cond arg
|
||||
// Examples:
|
||||
// proxy domain-suffix google.com
|
||||
|
Reference in New Issue
Block a user