feat:支持自定义DNS
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
.idea/
|
||||
Mmx
|
||||
Config.json
|
||||
Config.json
|
||||
/GoBuilder.bat
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package Modles
|
||||
|
||||
type Settings struct {
|
||||
QuitIfNetOk bool `json:"quit_if_net_ok"`
|
||||
DemoMode bool `json:"demo_mode"`
|
||||
QuitIfNetOk bool `json:"quit_if_net_ok"`
|
||||
DemoMode bool `json:"demo_mode"`
|
||||
Dns string `json:"dns"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
|
||||
@@ -23,6 +23,9 @@ func init() {
|
||||
Acid: "5",
|
||||
Enc: "srun_bx1",
|
||||
},
|
||||
Settings: Modles.Settings{
|
||||
Dns: "1.2.4.8",
|
||||
},
|
||||
}); err != nil {
|
||||
log.Println("创建配置文件失败:\n", err.Error())
|
||||
os.Exit(1)
|
||||
|
||||
@@ -66,6 +66,6 @@ func NetDailEr() func(ctx context.Context, network, address string) (net.Conn, e
|
||||
d := net.Dialer{
|
||||
Timeout: 20 * time.Second,
|
||||
}
|
||||
return d.DialContext(ctx, "udp", "1.2.4.8:53")
|
||||
return d.DialContext(ctx, "udp", Global.Config.Settings.Dns+":53")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user