mirror of
https://github.com/hanzozt/zt.git
synced 2026-11-03 05:01:58 +00:00
* don't check interface ips when getting ips from dns pool * assign dns ip range to loopback instead of one-ip-at-a-time * recycle unused dns ips * replace $dst_hostname when calculating dial identity * fall back to dummy resolver if server initialization fails.
40 lines
835 B
Go
40 lines
835 B
Go
package dns
|
|
|
|
import (
|
|
"github.com/michaelquigley/pfxlog"
|
|
"net"
|
|
)
|
|
|
|
type dummy struct{}
|
|
|
|
func (d dummy) AddHostname(_ string, _ net.IP) error {
|
|
pfxlog.Logger().Warnf("dummy resolver does not store hostname/ip mappings")
|
|
return nil
|
|
}
|
|
|
|
func (d dummy) AddDomain(_ string, _ func(string) (net.IP, error)) error {
|
|
pfxlog.Logger().Warnf("dummy resolver does not store hostname/ip mappings")
|
|
return nil
|
|
}
|
|
|
|
func (d dummy) Lookup(_ net.IP) (string, error) {
|
|
pfxlog.Logger().Warnf("dummy resolver does not store hostname/ip mappings")
|
|
return "", nil
|
|
}
|
|
|
|
func (d dummy) RemoveHostname(_ string) net.IP {
|
|
return nil
|
|
}
|
|
|
|
func (d dummy) RemoveDomain(_ string) {
|
|
}
|
|
|
|
func (d dummy) Cleanup() error {
|
|
return nil
|
|
}
|
|
|
|
func NewDummyResolver() Resolver {
|
|
pfxlog.Logger().Warnf("dummy resolver does not store hostname/ip mappings")
|
|
return &dummy{}
|
|
}
|