Add "nonIPQuery" to DNS outbound ("drop" by default)

And fixed a memory leak
And regenerated *.pb.go
This commit is contained in:
RPRX 2023-06-18 17:20:16 +00:00 committed by yuhan6665
parent 62e881b01a
commit 667279af57
5 changed files with 38 additions and 14 deletions

View file

@ -7,10 +7,11 @@ import (
)
type DNSOutboundConfig struct {
Network Network `json:"network"`
Address *Address `json:"address"`
Port uint16 `json:"port"`
UserLevel uint32 `json:"userLevel"`
Network Network `json:"network"`
Address *Address `json:"address"`
Port uint16 `json:"port"`
UserLevel uint32 `json:"userLevel"`
NonIPQuery string `json:"nonIPQuery"`
}
func (c *DNSOutboundConfig) Build() (proto.Message, error) {
@ -24,5 +25,12 @@ func (c *DNSOutboundConfig) Build() (proto.Message, error) {
if c.Address != nil {
config.Server.Address = c.Address.Build()
}
switch c.NonIPQuery {
case "":
c.NonIPQuery = "drop"
case "drop", "skip":
default:
return nil, newError(`unknown "nonIPQuery": `, c.NonIPQuery)
}
return config, nil
}