mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
apply coding style
This commit is contained in:
parent
8323add330
commit
d7c9a98d76
@ -74,10 +74,7 @@ type DNSThenOthersSniffResult struct {
|
||||
}
|
||||
|
||||
func (f DNSThenOthersSniffResult) IsProtoSubsetOf(protocolName string) bool {
|
||||
if strings.HasPrefix(protocolName, f.protocolOriginalName) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return strings.HasPrefix(protocolName, f.protocolOriginalName)
|
||||
}
|
||||
|
||||
func (DNSThenOthersSniffResult) Protocol() string {
|
||||
@ -88,7 +85,10 @@ func (f DNSThenOthersSniffResult) Domain() string {
|
||||
return f.domainName
|
||||
}
|
||||
|
||||
func newFakeDNSThenOthers(ctx context.Context, fakeDNSSniffer protocolSnifferWithMetadata, others []protocolSnifferWithMetadata) (protocolSnifferWithMetadata, error) {
|
||||
func newFakeDNSThenOthers(ctx context.Context, fakeDNSSniffer protocolSnifferWithMetadata, others []protocolSnifferWithMetadata) (
|
||||
protocolSnifferWithMetadata, error) { // nolint: unparam
|
||||
// ctx may be used in the future
|
||||
_ = ctx
|
||||
return protocolSnifferWithMetadata{
|
||||
protocolSniffer: func(ctx context.Context, bytes []byte) (SniffResult, error) {
|
||||
ipAddressInRangeValue := &ipAddressInRangeOpt{}
|
||||
@ -98,7 +98,7 @@ func newFakeDNSThenOthers(ctx context.Context, fakeDNSSniffer protocolSnifferWit
|
||||
return result, nil
|
||||
}
|
||||
if ipAddressInRangeValue.addressInRange != nil {
|
||||
if *ipAddressInRangeValue.addressInRange == true {
|
||||
if *ipAddressInRangeValue.addressInRange {
|
||||
for _, v := range others {
|
||||
if v.metadataSniffer || bytes != nil {
|
||||
if result, err := v.protocolSniffer(ctx, bytes); err == nil {
|
||||
|
@ -127,6 +127,7 @@ func TestFakeDNSMulti(t *testing.T) {
|
||||
}},
|
||||
},
|
||||
)
|
||||
common.Must(err)
|
||||
|
||||
err = fakeMulti.Start()
|
||||
|
||||
|
@ -73,7 +73,6 @@ func (o *Observer) background() {
|
||||
}
|
||||
time.Sleep(time.Second * 10)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,6 +80,7 @@ func (o *Observer) updateStatus(outbounds []string) {
|
||||
o.statusLock.Lock()
|
||||
defer o.statusLock.Unlock()
|
||||
// TODO should remove old inbound that is removed
|
||||
_ = outbounds
|
||||
}
|
||||
|
||||
func (o *Observer) probe(outbound string) ProbeResult {
|
||||
@ -111,7 +111,7 @@ func (o *Observer) probe(outbound string) ProbeResult {
|
||||
}
|
||||
return connection, nil
|
||||
},
|
||||
TLSHandshakeTimeout: time.Duration(time.Second * 5),
|
||||
TLSHandshakeTimeout: time.Second * 5,
|
||||
}
|
||||
httpClient := &http.Client{
|
||||
Transport: &httpTransport,
|
||||
@ -119,7 +119,7 @@ func (o *Observer) probe(outbound string) ProbeResult {
|
||||
return http.ErrUseLastResponse
|
||||
},
|
||||
Jar: nil,
|
||||
Timeout: time.Duration(time.Second * 5),
|
||||
Timeout: time.Second * 5,
|
||||
}
|
||||
var GETTime time.Duration
|
||||
err := task.Run(o.ctx, func() error {
|
||||
|
@ -175,6 +175,5 @@ func (br *BalancingRule) Build(ohm outbound.Manager) (*Balancer, error) {
|
||||
strategy: &RandomStrategy{},
|
||||
ohm: ohm,
|
||||
}, nil
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ package router
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
core "github.com/v2fly/v2ray-core/v4"
|
||||
"github.com/v2fly/v2ray-core/v4/common"
|
||||
"github.com/v2fly/v2ray-core/v4/features/dns"
|
||||
|
Loading…
Reference in New Issue
Block a user