newDNSCryptServer returns a new DNSCrypt server for the given address and protocol.
( ctx context.Context, addr netip.AddrPort, proto dnscrypt.Proto, )
| 86 | // newDNSCryptServer returns a new DNSCrypt server for the given address and |
| 87 | // protocol. |
| 88 | func (p *Proxy) newDNSCryptServer( |
| 89 | ctx context.Context, |
| 90 | addr netip.AddrPort, |
| 91 | proto dnscrypt.Proto, |
| 92 | ) (s *dnscrypt.Server, err error) { |
| 93 | p.logger.InfoContext(ctx, "creating dnscrypt server", "addr", addr, "proto", proto) |
| 94 | |
| 95 | return dnscrypt.NewServer(&dnscrypt.ServerConfig{ |
| 96 | Handler: &dnsCryptHandler{ |
| 97 | proxy: p, |
| 98 | reqSema: p.requestsSema, |
| 99 | }, |
| 100 | ResolverCert: p.DNSCryptResolverCert, |
| 101 | Logger: p.logger, |
| 102 | ProviderName: p.DNSCryptProviderName, |
| 103 | Addr: addr, |
| 104 | Proto: proto, |
| 105 | }) |
| 106 | } |
| 107 | |
| 108 | // dnsCryptHandler is the [dnscrypt.Handler] implementation that handles |
| 109 | // requests in the Proxy. |