mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-04-04 13:47:39 +03:00
Capitalize
This commit is contained in:
parent
c8d099735b
commit
03746b76bf
3 changed files with 16 additions and 16 deletions
|
@ -16,22 +16,22 @@ var (
|
||||||
rfc7050WKA2 = net.IPv4(192, 0, 0, 171)
|
rfc7050WKA2 = net.IPv4(192, 0, 0, 171)
|
||||||
)
|
)
|
||||||
|
|
||||||
type PluginDns64 struct {
|
type PluginDNS64 struct {
|
||||||
pref64Mutex *sync.RWMutex
|
pref64Mutex *sync.RWMutex
|
||||||
pref64 []*net.IPNet
|
pref64 []*net.IPNet
|
||||||
dns64Resolvers []string
|
dns64Resolvers []string
|
||||||
ipv4Resolver string
|
ipv4Resolver string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (plugin *PluginDns64) Name() string {
|
func (plugin *PluginDNS64) Name() string {
|
||||||
return "dns64"
|
return "dns64"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (plugin *PluginDns64) Description() string {
|
func (plugin *PluginDNS64) Description() string {
|
||||||
return "Synth DNS64 AAAA responses"
|
return "Synth DNS64 AAAA responses"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (plugin *PluginDns64) Init(proxy *Proxy) error {
|
func (plugin *PluginDNS64) Init(proxy *Proxy) error {
|
||||||
plugin.ipv4Resolver = proxy.listenAddresses[0] //recursively to ourselves
|
plugin.ipv4Resolver = proxy.listenAddresses[0] //recursively to ourselves
|
||||||
plugin.pref64Mutex = new(sync.RWMutex)
|
plugin.pref64Mutex = new(sync.RWMutex)
|
||||||
|
|
||||||
|
@ -56,15 +56,15 @@ func (plugin *PluginDns64) Init(proxy *Proxy) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (plugin *PluginDns64) Drop() error {
|
func (plugin *PluginDNS64) Drop() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (plugin *PluginDns64) Reload() error {
|
func (plugin *PluginDNS64) Reload() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (plugin *PluginDns64) Eval(pluginsState *PluginsState, msg *dns.Msg) error {
|
func (plugin *PluginDNS64) Eval(pluginsState *PluginsState, msg *dns.Msg) error {
|
||||||
if !hasAAAAQuestion(msg) || hasAAAAAnswer(msg) {
|
if !hasAAAAQuestion(msg) || hasAAAAAnswer(msg) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ func translateToIPv6(ipv4 net.IP, prefix *net.IPNet) net.IP {
|
||||||
return ipv6
|
return ipv6
|
||||||
}
|
}
|
||||||
|
|
||||||
func (plugin *PluginDns64) fetchPref64(resolver string) error {
|
func (plugin *PluginDNS64) fetchPref64(resolver string) error {
|
||||||
msg := new(dns.Msg)
|
msg := new(dns.Msg)
|
||||||
msg.SetQuestion(rfc7050WKN, dns.TypeAAAA)
|
msg.SetQuestion(rfc7050WKN, dns.TypeAAAA)
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ func (plugin *PluginDns64) fetchPref64(resolver string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (plugin *PluginDns64) refreshPref64() error {
|
func (plugin *PluginDNS64) refreshPref64() error {
|
||||||
for _, resolver := range plugin.dns64Resolvers {
|
for _, resolver := range plugin.dns64Resolvers {
|
||||||
if err := plugin.fetchPref64(resolver); err == nil {
|
if err := plugin.fetchPref64(resolver); err == nil {
|
||||||
break
|
break
|
||||||
|
|
|
@ -136,7 +136,7 @@ func (proxy *Proxy) InitPluginsGlobals() error {
|
||||||
*responsePlugins = append(*responsePlugins, Plugin(new(PluginBlockIP)))
|
*responsePlugins = append(*responsePlugins, Plugin(new(PluginBlockIP)))
|
||||||
}
|
}
|
||||||
if len(proxy.dns64Resolvers) != 0 || len(proxy.dns64Prefixes) != 0 {
|
if len(proxy.dns64Resolvers) != 0 || len(proxy.dns64Prefixes) != 0 {
|
||||||
*responsePlugins = append(*responsePlugins, Plugin(new(PluginDns64)))
|
*responsePlugins = append(*responsePlugins, Plugin(new(PluginDNS64)))
|
||||||
}
|
}
|
||||||
if proxy.cache {
|
if proxy.cache {
|
||||||
*responsePlugins = append(*responsePlugins, Plugin(new(PluginCacheResponse)))
|
*responsePlugins = append(*responsePlugins, Plugin(new(PluginCacheResponse)))
|
||||||
|
|
|
@ -87,11 +87,11 @@ type Proxy struct {
|
||||||
dns64Resolvers []string
|
dns64Resolvers []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (proxy *Proxy) registerUdpListener(conn *net.UDPConn) {
|
func (proxy *Proxy) registerUDPListener(conn *net.UDPConn) {
|
||||||
proxy.udpListeners = append(proxy.udpListeners, conn)
|
proxy.udpListeners = append(proxy.udpListeners, conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (proxy *Proxy) registerTcpListener(listener *net.TCPListener) {
|
func (proxy *Proxy) registerTCPListener(listener *net.TCPListener) {
|
||||||
proxy.tcpListeners = append(proxy.tcpListeners, listener)
|
proxy.tcpListeners = append(proxy.tcpListeners, listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,10 +161,10 @@ func (proxy *Proxy) addDNSListener(listenAddrStr string) {
|
||||||
FileDescriptorNum++
|
FileDescriptorNum++
|
||||||
|
|
||||||
dlog.Noticef("Now listening to %v [UDP]", listenUDPAddr)
|
dlog.Noticef("Now listening to %v [UDP]", listenUDPAddr)
|
||||||
proxy.registerUdpListener(listenerUDP.(*net.UDPConn))
|
proxy.registerUDPListener(listenerUDP.(*net.UDPConn))
|
||||||
|
|
||||||
dlog.Noticef("Now listening to %v [TCP]", listenAddrStr)
|
dlog.Noticef("Now listening to %v [TCP]", listenAddrStr)
|
||||||
proxy.registerTcpListener(listenerTCP.(*net.TCPListener))
|
proxy.registerTCPListener(listenerTCP.(*net.TCPListener))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (proxy *Proxy) addLocalDoHListener(listenAddrStr string) {
|
func (proxy *Proxy) addLocalDoHListener(listenAddrStr string) {
|
||||||
|
@ -287,7 +287,7 @@ func (proxy *Proxy) udpListenerFromAddr(listenAddr *net.UDPAddr) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
proxy.registerUdpListener(clientPc)
|
proxy.registerUDPListener(clientPc)
|
||||||
dlog.Noticef("Now listening to %v [UDP]", listenAddr)
|
dlog.Noticef("Now listening to %v [UDP]", listenAddr)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ func (proxy *Proxy) tcpListenerFromAddr(listenAddr *net.TCPAddr) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
proxy.registerTcpListener(acceptPc)
|
proxy.registerTCPListener(acceptPc)
|
||||||
dlog.Noticef("Now listening to %v [TCP]", listenAddr)
|
dlog.Noticef("Now listening to %v [TCP]", listenAddr)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue