mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-21 21:31:14 +07:00
fix: config marshaller
This commit is contained in:
@ -88,7 +88,7 @@ type DnsRouting struct {
|
||||
}
|
||||
type KeyableString string
|
||||
type Dns struct {
|
||||
IpVersionPrefer int `mapstructure:"ipversion_prefer"`
|
||||
IpVersionPrefer uint8 `mapstructure:"ipversion_prefer"`
|
||||
FixedDomainTtl []KeyableString `mapstructure:"fixed_domain_ttl"`
|
||||
Upstream []KeyableString `mapstructure:"upstream"`
|
||||
Routing DnsRouting `mapstructure:"routing"`
|
||||
|
@ -180,7 +180,7 @@ func (m *Marshaller) marshalLeaf(key string, from reflect.Value, depth int) (err
|
||||
case fmt.Stringer, string,
|
||||
uint8, uint16, uint32, uint64,
|
||||
int8, int16, int32, int64,
|
||||
float32, float64,
|
||||
float32, float64, int,
|
||||
bool:
|
||||
m.writeLine(depth, key+":"+strconv.Quote(fmt.Sprintf("%v", val)))
|
||||
case *config_parser.Function:
|
||||
|
@ -38,7 +38,7 @@ const (
|
||||
minFirefoxCacheTtl = 120
|
||||
)
|
||||
|
||||
type IpVersionPrefer int
|
||||
type IpVersionPrefer uint8
|
||||
|
||||
const (
|
||||
IpVersionPrefer_No IpVersionPrefer = 0
|
||||
@ -61,7 +61,7 @@ type DnsControllerOption struct {
|
||||
CacheRemoveCallback func(cache *DnsCache) (err error)
|
||||
NewCache func(fqdn string, answers []dnsmessage.RR, deadline time.Time) (cache *DnsCache, err error)
|
||||
BestDialerChooser func(req *udpRequest, upstream *dns.Upstream) (*dialArgument, error)
|
||||
IpVersionPrefer int
|
||||
IpVersionPrefer uint8
|
||||
FixedDomainTtl map[string]int
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ type DnsController struct {
|
||||
dnsCache map[string]*DnsCache
|
||||
}
|
||||
|
||||
func parseIpVersionPreference(prefer int) (uint16, error) {
|
||||
func parseIpVersionPreference(prefer uint8) (uint16, error) {
|
||||
switch prefer := IpVersionPrefer(prefer); prefer {
|
||||
case IpVersionPrefer_No:
|
||||
return 0, nil
|
||||
|
Reference in New Issue
Block a user