add port range support for service

This commit is contained in:
ginuerzh
2024-07-08 22:38:21 +08:00
parent 96f4d7bf5c
commit c1d0887a9b
73 changed files with 1915 additions and 316 deletions

View File

@ -9,6 +9,7 @@ import (
"github.com/go-gost/core/chain"
"github.com/go-gost/core/logger"
"github.com/go-gost/core/resolver"
xchain "github.com/go-gost/x/chain"
resolver_util "github.com/go-gost/x/internal/util/resolver"
"github.com/go-gost/x/resolver/exchanger"
"github.com/miekg/dns"
@ -67,7 +68,7 @@ func NewResolver(nameservers []NameServer, opts ...Option) (resolver.Resolver, e
ex, err := exchanger.NewExchanger(
addr,
exchanger.RouterOption(
chain.NewRouter(
xchain.NewRouter(
chain.ChainRouterOption(server.Chain),
chain.LoggerRouterOption(options.logger),
),
@ -165,7 +166,7 @@ func (r *localResolver) resolveAsync(ctx context.Context, server *NameServer, ho
return
}
func (r *localResolver) lookupCache(ctx context.Context, server *NameServer, host string) (ips []net.IP, ttl time.Duration, ok bool) {
func (r *localResolver) lookupCache(_ context.Context, server *NameServer, host string) (ips []net.IP, ttl time.Duration, ok bool) {
lookup := func(t uint16, host string) (ips []net.IP, ttl time.Duration, ok bool) {
mq := dns.Msg{}
mq.SetQuestion(dns.Fqdn(host), t)