mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-06-12 07:19:53 +00:00
chore: setResolver
This commit is contained in:
parent
c41d81886c
commit
ccbd959007
@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"io"
|
"io"
|
||||||
@ -30,13 +29,7 @@ func client(config *clientConfig) {
|
|||||||
logrus.WithField("config", config.String()).Info("Client configuration loaded")
|
logrus.WithField("config", config.String()).Info("Client configuration loaded")
|
||||||
// Resolver
|
// Resolver
|
||||||
if len(config.Resolver) > 0 {
|
if len(config.Resolver) > 0 {
|
||||||
net.DefaultResolver = &net.Resolver{
|
setResolver(config.Resolver)
|
||||||
PreferGo: true,
|
|
||||||
Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
|
|
||||||
d := net.Dialer{}
|
|
||||||
return d.DialContext(ctx, "udp", config.Resolver)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// TLS
|
// TLS
|
||||||
tlsConfig := &tls.Config{
|
tlsConfig := &tls.Config{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"github.com/lucas-clemente/quic-go"
|
"github.com/lucas-clemente/quic-go"
|
||||||
"github.com/lucas-clemente/quic-go/congestion"
|
"github.com/lucas-clemente/quic-go/congestion"
|
||||||
@ -25,13 +24,7 @@ func server(config *serverConfig) {
|
|||||||
logrus.WithField("config", config.String()).Info("Server configuration loaded")
|
logrus.WithField("config", config.String()).Info("Server configuration loaded")
|
||||||
// Resolver
|
// Resolver
|
||||||
if len(config.Resolver) > 0 {
|
if len(config.Resolver) > 0 {
|
||||||
net.DefaultResolver = &net.Resolver{
|
setResolver(config.Resolver)
|
||||||
PreferGo: true,
|
|
||||||
Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
|
|
||||||
d := net.Dialer{}
|
|
||||||
return d.DialContext(ctx, "udp", config.Resolver)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Load TLS config
|
// Load TLS config
|
||||||
var tlsConfig *tls.Config
|
var tlsConfig *tls.Config
|
||||||
|
Loading…
x
Reference in New Issue
Block a user