mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 15:36:41 -05:00
apply coding style
This commit is contained in:
parent
2f35bbecbe
commit
1e282944a6
@ -60,9 +60,9 @@ func (f fakeDNSSniffResult) Domain() string {
|
|||||||
return f.domainName
|
return f.domainName
|
||||||
}
|
}
|
||||||
|
|
||||||
type fakeDnsExtraOpts int
|
type fakeDNSExtraOpts int
|
||||||
|
|
||||||
const ipAddressInRange fakeDnsExtraOpts = 1
|
const ipAddressInRange fakeDNSExtraOpts = 1
|
||||||
|
|
||||||
type ipAddressInRangeOpt struct {
|
type ipAddressInRangeOpt struct {
|
||||||
addressInRange *bool
|
addressInRange *bool
|
||||||
@ -107,10 +107,9 @@ func newFakeDNSThenOthers(ctx context.Context, fakeDNSSniffer protocolSnifferWit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil, common.ErrNoClue
|
return nil, common.ErrNoClue
|
||||||
} else {
|
|
||||||
newError("ip address not in fake dns range, return as is").AtDebug().WriteToLog()
|
|
||||||
return nil, common.ErrNoClue
|
|
||||||
}
|
}
|
||||||
|
newError("ip address not in fake dns range, return as is").AtDebug().WriteToLog()
|
||||||
|
return nil, common.ErrNoClue
|
||||||
} else {
|
} else {
|
||||||
newError("fake dns sniffer did not set address in range option, assume false.").AtWarning().WriteToLog()
|
newError("fake dns sniffer did not set address in range option, assume false.").AtWarning().WriteToLog()
|
||||||
return nil, common.ErrNoClue
|
return nil, common.ErrNoClue
|
||||||
|
@ -27,9 +27,9 @@ func (fkdns *Holder) IsIPInIPPool(ip net.Address) bool {
|
|||||||
return fkdns.ipRange.Contains(ip.IP())
|
return fkdns.ipRange.Contains(ip.IP())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fkdns *Holder) GetFakeIPForDomain3(domain string, IPv4, IPv6 bool) []net.Address {
|
func (fkdns *Holder) GetFakeIPForDomain3(domain string, ipv4, ipv6 bool) []net.Address {
|
||||||
isIPv6 := fkdns.ipRange.IP.To4() == nil
|
isIPv6 := fkdns.ipRange.IP.To4() == nil
|
||||||
if (isIPv6 && IPv6) || (!isIPv6 && IPv4) {
|
if (isIPv6 && ipv6) || (!isIPv6 && ipv4) {
|
||||||
return fkdns.GetFakeIPForDomain(domain)
|
return fkdns.GetFakeIPForDomain(domain)
|
||||||
}
|
}
|
||||||
return []net.Address{}
|
return []net.Address{}
|
||||||
@ -147,10 +147,10 @@ func (h *HolderMulti) IsIPInIPPool(ip net.Address) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *HolderMulti) GetFakeIPForDomain3(domain string, IPv4, IPv6 bool) []net.Address {
|
func (h *HolderMulti) GetFakeIPForDomain3(domain string, ipv4, ipv6 bool) []net.Address {
|
||||||
var ret []net.Address
|
var ret []net.Address
|
||||||
for _, v := range h.holders {
|
for _, v := range h.holders {
|
||||||
ret = append(ret, v.GetFakeIPForDomain3(domain, IPv4, IPv6)...)
|
ret = append(ret, v.GetFakeIPForDomain3(domain, ipv4, ipv6)...)
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
@ -118,10 +118,10 @@ func TestFakeDnsHolderCreateMappingAndRollOver(t *testing.T) {
|
|||||||
|
|
||||||
func TestFakeDNSMulti(t *testing.T) {
|
func TestFakeDNSMulti(t *testing.T) {
|
||||||
fakeMulti, err := NewFakeDNSHolderMulti(&FakeDnsPoolMulti{
|
fakeMulti, err := NewFakeDNSHolderMulti(&FakeDnsPoolMulti{
|
||||||
Pools: []*FakeDnsPool{&FakeDnsPool{
|
Pools: []*FakeDnsPool{{
|
||||||
IpPool: "240.0.0.0/12",
|
IpPool: "240.0.0.0/12",
|
||||||
LruSize: 256,
|
LruSize: 256,
|
||||||
}, &FakeDnsPool{
|
}, {
|
||||||
IpPool: "fddd:c5b4:ff5f:f4f0::/64",
|
IpPool: "fddd:c5b4:ff5f:f4f0::/64",
|
||||||
LruSize: 256,
|
LruSize: 256,
|
||||||
}},
|
}},
|
||||||
|
@ -589,6 +589,7 @@ func (c *Config) Build() (*core.Config, error) {
|
|||||||
sb := strings.Builder{}
|
sb := strings.Builder{}
|
||||||
return nil, newError("Cannot load service").Base(developererr).Base(err).Base(newError(sb.String()))
|
return nil, newError("Cannot load service").Base(developererr).Base(err).Base(newError(sb.String()))
|
||||||
} else {
|
} else {
|
||||||
|
// Using a else here is required to keep msg in scope
|
||||||
config.App = append(config.App, msg...)
|
config.App = append(config.App, msg...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user