docstring_tokens
stringlengths
0
76.5k
code_tokens
stringlengths
75
1.81M
label_window
listlengths
4
2.12k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
local, _ := strconv.ParseUint(port, 10, 16)
<mask> if err != nil { <mask> port = "0" <mask> } <mask> <mask> local, _ := strconv.ParseInt(port, 10, 16) <mask> <mask> addr, err := lookupLocalAddr(ifaceName, network, nil, int(local)) <mask> if err != nil { <mask> return "", err <mask> } </s> Fix: multiple port string parsing overflow (#1868) Ports in TCP and UDP should be parsed as an unsigned integer, otherwise ports > 32767 get truncated to 32767. As this is the case with Metadata.UDPAddr(), this fundamentally breaks UDP connections where demand for high port numbers is high. This commit fixes all known cases where ParseInt is used for ports, and has been verified to fix Discord voice connections on port 50001~50004. Fixes: d40e5e4fe6c11311ee1de82779a985c3ca47d03a Co-authored-by: Hamster Tian <haotia@gmail.com> </s> remove local, _ = strconv.ParseInt(port, 10, 16) </s> add local, _ = strconv.ParseUint(port, 10, 16) </s> remove local := int64(0) </s> add local := uint64(0) </s> remove port, _ := strconv.ParseInt(m.DstPort, 10, 16) </s> add port, _ := strconv.ParseUint(m.DstPort, 10, 16) </s> remove port, _ := strconv.ParseInt(metadata.DstPort, 10, 16) </s> add port, _ := strconv.ParseUint(metadata.DstPort, 10, 16)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8679968ab0a3112cfe4368118626e879609bfe67
component/dialer/bind_others.go
port, _ := strconv.ParseUint(m.DstPort, 10, 16)
<mask> func (m *Metadata) UDPAddr() *net.UDPAddr { <mask> if m.NetWork != UDP || m.DstIP == nil { <mask> return nil <mask> } <mask> port, _ := strconv.ParseInt(m.DstPort, 10, 16) <mask> return &net.UDPAddr{ <mask> IP: m.DstIP, <mask> Port: int(port), <mask> } <mask> } </s> Fix: multiple port string parsing overflow (#1868) Ports in TCP and UDP should be parsed as an unsigned integer, otherwise ports > 32767 get truncated to 32767. As this is the case with Metadata.UDPAddr(), this fundamentally breaks UDP connections where demand for high port numbers is high. This commit fixes all known cases where ParseInt is used for ports, and has been verified to fix Discord voice connections on port 50001~50004. Fixes: d40e5e4fe6c11311ee1de82779a985c3ca47d03a Co-authored-by: Hamster Tian <haotia@gmail.com> </s> remove local := int64(0) </s> add local := uint64(0) </s> remove local, _ = strconv.ParseInt(port, 10, 16) </s> add local, _ = strconv.ParseUint(port, 10, 16) </s> remove local, _ := strconv.ParseInt(port, 10, 16) </s> add local, _ := strconv.ParseUint(port, 10, 16) </s> remove port, _ := strconv.ParseInt(metadata.DstPort, 10, 16) </s> add port, _ := strconv.ParseUint(metadata.DstPort, 10, 16)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8679968ab0a3112cfe4368118626e879609bfe67
constant/metadata.go
<mask> "encoding/json" <mask> "errors" <mask> "net" <mask> "net/http" <mask> "sync/atomic" <mask> "time" <mask> <mask> "github.com/Dreamacro/clash/common/queue" <mask> C "github.com/Dreamacro/clash/constant" <mask> ) </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
adapters/outbound/base.go
"go.uber.org/atomic"
<mask> <mask> "github.com/Dreamacro/clash/common/queue" <mask> C "github.com/Dreamacro/clash/constant" <mask> ) <mask> <mask> type Base struct { <mask> name string <mask> addr string <mask> tp C.AdapterType </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove "sync/atomic" </s> add </s> remove UUID uuid.UUID `json:"id"` Metadata *C.Metadata `json:"metadata"` UploadTotal int64 `json:"upload"` DownloadTotal int64 `json:"download"` Start time.Time `json:"start"` Chain C.Chain `json:"chains"` Rule string `json:"rule"` RulePayload string `json:"rulePayload"` </s> add UUID uuid.UUID `json:"id"` Metadata *C.Metadata `json:"metadata"` UploadTotal *atomic.Int64 `json:"upload"` DownloadTotal *atomic.Int64 `json:"download"` Start time.Time `json:"start"` Chain C.Chain `json:"chains"` Rule string `json:"rule"` RulePayload string `json:"rulePayload"` </s> remove "sync/atomic" </s> add </s> remove alive uint32 </s> add alive *atomic.Bool
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
adapters/outbound/base.go
alive *atomic.Bool
<mask> <mask> type Proxy struct { <mask> C.ProxyAdapter <mask> history *queue.Queue <mask> alive uint32 <mask> } <mask> <mask> func (p *Proxy) Alive() bool { <mask> return atomic.LoadUint32(&p.alive) > 0 <mask> } </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove return atomic.LoadUint32(&p.alive) > 0 </s> add return p.alive.Load() </s> remove if atomic.LoadUint32(&p.alive) == 0 { </s> add if !p.alive.Load() { </s> remove atomic.StoreUint32(&p.alive, 0) </s> add p.alive.Store(false) </s> remove return atomic.LoadInt64(&m.uploadBlip), atomic.LoadInt64(&m.downloadBlip) </s> add return m.uploadBlip.Load(), m.downloadBlip.Load() </s> remove atomic.StoreInt64(&m.uploadBlip, atomic.LoadInt64(&m.uploadTemp)) atomic.StoreInt64(&m.uploadTemp, 0) atomic.StoreInt64(&m.downloadBlip, atomic.LoadInt64(&m.downloadTemp)) atomic.StoreInt64(&m.downloadTemp, 0) </s> add m.uploadBlip.Store(m.uploadTemp.Load()) m.uploadTemp.Store(0) m.downloadBlip.Store(m.downloadTemp.Load()) m.downloadTemp.Store(0)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
adapters/outbound/base.go
return p.alive.Load()
<mask> alive uint32 <mask> } <mask> <mask> func (p *Proxy) Alive() bool { <mask> return atomic.LoadUint32(&p.alive) > 0 <mask> } <mask> <mask> func (p *Proxy) Dial(metadata *C.Metadata) (C.Conn, error) { <mask> ctx, cancel := context.WithTimeout(context.Background(), tcpTimeout) <mask> defer cancel() </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove alive uint32 </s> add alive *atomic.Bool </s> remove atomic.StoreUint32(&p.alive, 0) </s> add p.alive.Store(false) </s> remove if atomic.LoadUint32(&p.alive) == 0 { </s> add if !p.alive.Load() { </s> remove if err == nil { atomic.StoreUint32(&p.alive, 1) } else { atomic.StoreUint32(&p.alive, 0) } </s> add p.alive.Store(err == nil) </s> remove return atomic.LoadInt64(&m.uploadBlip), atomic.LoadInt64(&m.downloadBlip) </s> add return m.uploadBlip.Load(), m.downloadBlip.Load()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
adapters/outbound/base.go
p.alive.Store(false)
<mask> <mask> func (p *Proxy) DialContext(ctx context.Context, metadata *C.Metadata) (C.Conn, error) { <mask> conn, err := p.ProxyAdapter.DialContext(ctx, metadata) <mask> if err != nil { <mask> atomic.StoreUint32(&p.alive, 0) <mask> } <mask> return conn, err <mask> } <mask> <mask> func (p *Proxy) DelayHistory() []C.DelayHistory { </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove if err == nil { atomic.StoreUint32(&p.alive, 1) } else { atomic.StoreUint32(&p.alive, 0) } </s> add p.alive.Store(err == nil) </s> remove return atomic.LoadUint32(&p.alive) > 0 </s> add return p.alive.Load() </s> remove atomic.AddInt64(&tt.DownloadTotal, download) </s> add tt.DownloadTotal.Add(download) </s> remove if atomic.LoadUint32(&p.alive) == 0 { </s> add if !p.alive.Load() { </s> remove atomic.AddInt64(&ut.DownloadTotal, download) </s> add ut.DownloadTotal.Add(download)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
adapters/outbound/base.go
if !p.alive.Load() {
<mask> <mask> // LastDelay return last history record. if proxy is not alive, return the max value of uint16. <mask> func (p *Proxy) LastDelay() (delay uint16) { <mask> var max uint16 = 0xffff <mask> if atomic.LoadUint32(&p.alive) == 0 { <mask> return max <mask> } <mask> <mask> last := p.history.Last() <mask> if last == nil { </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove if err == nil { atomic.StoreUint32(&p.alive, 1) } else { atomic.StoreUint32(&p.alive, 0) } </s> add p.alive.Store(err == nil) </s> remove atomic.StoreUint32(&p.alive, 0) </s> add p.alive.Store(false) </s> remove alive uint32 </s> add alive *atomic.Bool </s> remove return atomic.LoadUint32(&p.alive) > 0 </s> add return p.alive.Load() </s> remove var shardCount int32 = 0 </s> add var shardCount = atomic.NewInt32(0)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
adapters/outbound/base.go
p.alive.Store(err == nil)
<mask> <mask> // URLTest get the delay for the specified URL <mask> func (p *Proxy) URLTest(ctx context.Context, url string) (t uint16, err error) { <mask> defer func() { <mask> if err == nil { <mask> atomic.StoreUint32(&p.alive, 1) <mask> } else { <mask> atomic.StoreUint32(&p.alive, 0) <mask> } <mask> record := C.DelayHistory{Time: time.Now()} <mask> if err == nil { <mask> record.Delay = t <mask> } <mask> p.history.Put(record) </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove atomic.StoreUint32(&p.alive, 0) </s> add p.alive.Store(false) </s> remove if atomic.LoadUint32(&p.alive) == 0 { </s> add if !p.alive.Load() { </s> remove atomic.AddInt32(&shardCount, 1) </s> add shardCount.Inc() </s> remove return atomic.LoadUint32(&p.alive) > 0 </s> add return p.alive.Load() </s> remove atomic.AddInt64(&tt.DownloadTotal, download) </s> add tt.DownloadTotal.Add(download)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
adapters/outbound/base.go
return &Proxy{adapter, queue.New(10), atomic.NewBool(true)}
<mask> return <mask> } <mask> <mask> func NewProxy(adapter C.ProxyAdapter) *Proxy { <mask> return &Proxy{adapter, queue.New(10), 1} <mask> } </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove UploadTotal: atomic.LoadInt64(&m.uploadTotal), DownloadTotal: atomic.LoadInt64(&m.downloadTotal), </s> add UploadTotal: m.uploadTotal.Load(), DownloadTotal: m.downloadTotal.Load(), </s> remove return atomic.LoadInt64(&m.uploadBlip), atomic.LoadInt64(&m.downloadBlip) </s> add return m.uploadBlip.Load(), m.downloadBlip.Load() </s> remove return atomic.LoadUint32(&p.alive) > 0 </s> add return p.alive.Load() </s> remove atomic.AddInt64(&m.downloadTemp, size) atomic.AddInt64(&m.downloadTotal, size) </s> add m.downloadTemp.Add(size) m.downloadTotal.Add(size) </s> remove alive uint32 </s> add alive *atomic.Bool
[ "keep", "keep", "keep", "keep", "replace", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
adapters/outbound/base.go
<mask> package observable <mask> <mask> import ( <mask> "sync" <mask> "sync/atomic" <mask> "testing" <mask> "time" <mask> <mask> "github.com/stretchr/testify/assert" <mask> ) </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
common/observable/observable_test.go
"go.uber.org/atomic"
<mask> <mask> "github.com/stretchr/testify/assert" <mask> ) <mask> <mask> func iterator(item []interface{}) chan interface{} { <mask> ch := make(chan interface{}) <mask> go func() { </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove atomic.AddInt32(&count, 1) </s> add count.Inc() </s> remove atomic.AddInt32(&shardCount, 1) </s> add shardCount.Inc() </s> remove var count int32 </s> add var count = atomic.NewInt32(0) </s> remove assert.Equal(t, int32(10), count) </s> add assert.Equal(t, int32(10), count.Load())
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
common/observable/observable_test.go
func TestObservable_MultiSubscribe(t *testing.T) {
<mask> } <mask> assert.Equal(t, count, 5) <mask> } <mask> <mask> func TestObservable_MutilSubscribe(t *testing.T) { <mask> iter := iterator([]interface{}{1, 2, 3, 4, 5}) <mask> src := NewObservable(iter) <mask> ch1, _ := src.Subscribe() <mask> ch2, _ := src.Subscribe() <mask> var count int32 </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove var count int32 </s> add var count = atomic.NewInt32(0) </s> remove assert.Equal(t, int32(10), count) </s> add assert.Equal(t, int32(10), count.Load()) </s> remove var shardCount int32 = 0 </s> add var shardCount = atomic.NewInt32(0) </s> remove assert.Equal(t, int32(4), shardCount) </s> add assert.Equal(t, int32(4), shardCount.Load())
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
common/observable/observable_test.go
var count = atomic.NewInt32(0)
<mask> iter := iterator([]interface{}{1, 2, 3, 4, 5}) <mask> src := NewObservable(iter) <mask> ch1, _ := src.Subscribe() <mask> ch2, _ := src.Subscribe() <mask> var count int32 <mask> <mask> var wg sync.WaitGroup <mask> wg.Add(2) <mask> waitCh := func(ch <-chan interface{}) { <mask> for range ch { </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove func TestObservable_MutilSubscribe(t *testing.T) { </s> add func TestObservable_MultiSubscribe(t *testing.T) { </s> remove atomic.AddInt32(&count, 1) </s> add count.Inc() </s> remove assert.Equal(t, int32(10), count) </s> add assert.Equal(t, int32(10), count.Load()) </s> remove var shardCount int32 = 0 </s> add var shardCount = atomic.NewInt32(0)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
common/observable/observable_test.go
count.Inc()
<mask> var wg sync.WaitGroup <mask> wg.Add(2) <mask> waitCh := func(ch <-chan interface{}) { <mask> for range ch { <mask> atomic.AddInt32(&count, 1) <mask> } <mask> wg.Done() <mask> } <mask> go waitCh(ch1) <mask> go waitCh(ch2) </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove var count int32 </s> add var count = atomic.NewInt32(0) </s> remove atomic.AddInt32(&shardCount, 1) </s> add shardCount.Inc() </s> remove assert.Equal(t, int32(10), count) </s> add assert.Equal(t, int32(10), count.Load()) </s> remove atomic.StoreInt64(&m.uploadBlip, atomic.LoadInt64(&m.uploadTemp)) atomic.StoreInt64(&m.uploadTemp, 0) atomic.StoreInt64(&m.downloadBlip, atomic.LoadInt64(&m.downloadTemp)) atomic.StoreInt64(&m.downloadTemp, 0) </s> add m.uploadBlip.Store(m.uploadTemp.Load()) m.uploadTemp.Store(0) m.downloadBlip.Store(m.downloadTemp.Load()) m.downloadTemp.Store(0)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
common/observable/observable_test.go
assert.Equal(t, int32(10), count.Load())
<mask> } <mask> go waitCh(ch1) <mask> go waitCh(ch2) <mask> wg.Wait() <mask> assert.Equal(t, int32(10), count) <mask> } <mask> <mask> func TestObservable_UnSubscribe(t *testing.T) { <mask> iter := iterator([]interface{}{1, 2, 3, 4, 5}) <mask> src := NewObservable(iter) </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove func TestObservable_MutilSubscribe(t *testing.T) { </s> add func TestObservable_MultiSubscribe(t *testing.T) { </s> remove var count int32 </s> add var count = atomic.NewInt32(0) </s> remove atomic.AddInt32(&count, 1) </s> add count.Inc() </s> remove assert.Equal(t, int32(4), shardCount) </s> add assert.Equal(t, int32(4), shardCount.Load()) </s> remove atomic.AddInt32(&shardCount, 1) </s> add shardCount.Inc()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
common/observable/observable_test.go
<mask> package singledo <mask> <mask> import ( <mask> "sync" <mask> "sync/atomic" <mask> "testing" <mask> "time" <mask> <mask> "github.com/stretchr/testify/assert" <mask> ) </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
common/singledo/singledo_test.go
"go.uber.org/atomic"
<mask> "testing" <mask> "time" <mask> <mask> "github.com/stretchr/testify/assert" <mask> ) <mask> <mask> func TestBasic(t *testing.T) { <mask> single := NewSingle(time.Millisecond * 30) <mask> foo := 0 <mask> var shardCount = atomic.NewInt32(0) </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove var shardCount int32 = 0 </s> add var shardCount = atomic.NewInt32(0) </s> remove assert.Equal(t, int32(4), shardCount) </s> add assert.Equal(t, int32(4), shardCount.Load()) </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add </s> remove var count int32 </s> add var count = atomic.NewInt32(0)
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
common/singledo/singledo_test.go
var shardCount = atomic.NewInt32(0)
<mask> <mask> func TestBasic(t *testing.T) { <mask> single := NewSingle(time.Millisecond * 30) <mask> foo := 0 <mask> var shardCount int32 = 0 <mask> call := func() (interface{}, error) { <mask> foo++ <mask> time.Sleep(time.Millisecond * 5) <mask> return nil, nil <mask> } </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove assert.Equal(t, int32(4), shardCount) </s> add assert.Equal(t, int32(4), shardCount.Load()) </s> remove func TestObservable_MutilSubscribe(t *testing.T) { </s> add func TestObservable_MultiSubscribe(t *testing.T) { </s> remove m.uploadTemp = 0 m.uploadBlip = 0 m.uploadTotal = 0 m.downloadTemp = 0 m.downloadBlip = 0 m.downloadTotal = 0 </s> add m.uploadTemp.Store(0) m.uploadBlip.Store(0) m.uploadTotal.Store(0) m.downloadTemp.Store(0) m.downloadBlip.Store(0) m.downloadTotal.Store(0) </s> remove if atomic.LoadUint32(&p.alive) == 0 { </s> add if !p.alive.Load() {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
common/singledo/singledo_test.go
shardCount.Inc()
<mask> for i := 0; i < n; i++ { <mask> go func() { <mask> _, _, shard := single.Do(call) <mask> if shard { <mask> atomic.AddInt32(&shardCount, 1) <mask> } <mask> wg.Done() <mask> }() <mask> } <mask> </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove atomic.AddInt32(&count, 1) </s> add count.Inc() </s> remove if err == nil { atomic.StoreUint32(&p.alive, 1) } else { atomic.StoreUint32(&p.alive, 0) } </s> add p.alive.Store(err == nil) </s> remove assert.Equal(t, int32(10), count) </s> add assert.Equal(t, int32(10), count.Load()) </s> remove atomic.StoreInt64(&m.uploadBlip, atomic.LoadInt64(&m.uploadTemp)) atomic.StoreInt64(&m.uploadTemp, 0) atomic.StoreInt64(&m.downloadBlip, atomic.LoadInt64(&m.downloadTemp)) atomic.StoreInt64(&m.downloadTemp, 0) </s> add m.uploadBlip.Store(m.uploadTemp.Load()) m.uploadTemp.Store(0) m.downloadBlip.Store(m.downloadTemp.Load()) m.downloadTemp.Store(0)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
common/singledo/singledo_test.go
assert.Equal(t, int32(4), shardCount.Load())
<mask> } <mask> <mask> wg.Wait() <mask> assert.Equal(t, 1, foo) <mask> assert.Equal(t, int32(4), shardCount) <mask> } <mask> <mask> func TestTimer(t *testing.T) { <mask> single := NewSingle(time.Millisecond * 30) <mask> foo := 0 </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove var shardCount int32 = 0 </s> add var shardCount = atomic.NewInt32(0) </s> remove assert.Equal(t, int32(10), count) </s> add assert.Equal(t, int32(10), count.Load()) </s> remove func TestObservable_MutilSubscribe(t *testing.T) { </s> add func TestObservable_MultiSubscribe(t *testing.T) { </s> remove m.uploadTemp = 0 m.uploadBlip = 0 m.uploadTotal = 0 m.downloadTemp = 0 m.downloadBlip = 0 m.downloadTotal = 0 </s> add m.uploadTemp.Store(0) m.uploadBlip.Store(0) m.uploadTotal.Store(0) m.downloadTemp.Store(0) m.downloadBlip.Store(0) m.downloadTotal.Store(0)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
common/singledo/singledo_test.go
go.uber.org/atomic v1.7.0
<mask> github.com/sirupsen/logrus v1.7.0 <mask> github.com/stretchr/testify v1.6.1 <mask> golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 <mask> golang.org/x/net v0.0.0-20201020065357-d65d470038a5 <mask> golang.org/x/sync v0.0.0-20201008141435-b3e1573b7520 <mask> golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13 <mask> gopkg.in/yaml.v2 v2.3.0 <mask> ) </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
go.mod
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
<mask> github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= <mask> github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= <mask> github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= <mask> github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= <mask> github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= <mask> go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= <mask> go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove func TestObservable_MutilSubscribe(t *testing.T) { </s> add func TestObservable_MultiSubscribe(t *testing.T) { </s> remove atomic.AddInt32(&shardCount, 1) </s> add shardCount.Inc() </s> remove var shardCount int32 = 0 </s> add var shardCount = atomic.NewInt32(0)
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
go.sum
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
<mask> github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= <mask> github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= <mask> github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= <mask> golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= <mask> golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= <mask> golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= <mask> golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= <mask> golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= <mask> golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove func TestObservable_MutilSubscribe(t *testing.T) { </s> add func TestObservable_MultiSubscribe(t *testing.T) { </s> remove atomic.AddInt32(&shardCount, 1) </s> add shardCount.Inc() </s> remove var shardCount int32 = 0 </s> add var shardCount = atomic.NewInt32(0)
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
go.sum
<mask> package tunnel <mask> <mask> import ( <mask> "sync" <mask> "sync/atomic" <mask> "time" <mask> ) <mask> <mask> var DefaultManager *Manager <mask> </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add </s> remove DefaultManager = &Manager{} </s> add DefaultManager = &Manager{ uploadTemp: atomic.NewInt64(0), downloadTemp: atomic.NewInt64(0), uploadBlip: atomic.NewInt64(0), downloadBlip: atomic.NewInt64(0), uploadTotal: atomic.NewInt64(0), downloadTotal: atomic.NewInt64(0), }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/manager.go
"go.uber.org/atomic"
<mask> <mask> import ( <mask> "sync" <mask> "time" <mask> ) <mask> <mask> var DefaultManager *Manager <mask> <mask> func init() { </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add </s> remove DefaultManager = &Manager{} </s> add DefaultManager = &Manager{ uploadTemp: atomic.NewInt64(0), downloadTemp: atomic.NewInt64(0), uploadBlip: atomic.NewInt64(0), downloadBlip: atomic.NewInt64(0), uploadTotal: atomic.NewInt64(0), downloadTotal: atomic.NewInt64(0), } </s> remove "sync/atomic" </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/manager.go
DefaultManager = &Manager{ uploadTemp: atomic.NewInt64(0), downloadTemp: atomic.NewInt64(0), uploadBlip: atomic.NewInt64(0), downloadBlip: atomic.NewInt64(0), uploadTotal: atomic.NewInt64(0), downloadTotal: atomic.NewInt64(0), }
<mask> <mask> var DefaultManager *Manager <mask> <mask> func init() { <mask> DefaultManager = &Manager{} <mask> <mask> go DefaultManager.handle() <mask> } <mask> <mask> type Manager struct { </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove "sync/atomic" </s> add </s> remove uploadTemp int64 downloadTemp int64 uploadBlip int64 downloadBlip int64 uploadTotal int64 downloadTotal int64 </s> add uploadTemp *atomic.Int64 downloadTemp *atomic.Int64 uploadBlip *atomic.Int64 downloadBlip *atomic.Int64 uploadTotal *atomic.Int64 downloadTotal *atomic.Int64 </s> remove alive uint32 </s> add alive *atomic.Bool </s> remove atomic.AddInt32(&count, 1) </s> add count.Inc()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/manager.go
uploadTemp *atomic.Int64 downloadTemp *atomic.Int64 uploadBlip *atomic.Int64 downloadBlip *atomic.Int64 uploadTotal *atomic.Int64 downloadTotal *atomic.Int64
<mask> } <mask> <mask> type Manager struct { <mask> connections sync.Map <mask> uploadTemp int64 <mask> downloadTemp int64 <mask> uploadBlip int64 <mask> downloadBlip int64 <mask> uploadTotal int64 <mask> downloadTotal int64 <mask> } <mask> <mask> func (m *Manager) Join(c tracker) { <mask> m.connections.Store(c.ID(), c) <mask> } </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove atomic.StoreInt64(&m.uploadBlip, atomic.LoadInt64(&m.uploadTemp)) atomic.StoreInt64(&m.uploadTemp, 0) atomic.StoreInt64(&m.downloadBlip, atomic.LoadInt64(&m.downloadTemp)) atomic.StoreInt64(&m.downloadTemp, 0) </s> add m.uploadBlip.Store(m.uploadTemp.Load()) m.uploadTemp.Store(0) m.downloadBlip.Store(m.downloadTemp.Load()) m.downloadTemp.Store(0) </s> remove UUID uuid.UUID `json:"id"` Metadata *C.Metadata `json:"metadata"` UploadTotal int64 `json:"upload"` DownloadTotal int64 `json:"download"` Start time.Time `json:"start"` Chain C.Chain `json:"chains"` Rule string `json:"rule"` RulePayload string `json:"rulePayload"` </s> add UUID uuid.UUID `json:"id"` Metadata *C.Metadata `json:"metadata"` UploadTotal *atomic.Int64 `json:"upload"` DownloadTotal *atomic.Int64 `json:"download"` Start time.Time `json:"start"` Chain C.Chain `json:"chains"` Rule string `json:"rule"` RulePayload string `json:"rulePayload"` </s> remove return atomic.LoadInt64(&m.uploadBlip), atomic.LoadInt64(&m.downloadBlip) </s> add return m.uploadBlip.Load(), m.downloadBlip.Load() </s> remove DefaultManager = &Manager{} </s> add DefaultManager = &Manager{ uploadTemp: atomic.NewInt64(0), downloadTemp: atomic.NewInt64(0), uploadBlip: atomic.NewInt64(0), downloadBlip: atomic.NewInt64(0), uploadTotal: atomic.NewInt64(0), downloadTotal: atomic.NewInt64(0), } </s> remove atomic.AddInt64(&m.downloadTemp, size) atomic.AddInt64(&m.downloadTotal, size) </s> add m.downloadTemp.Add(size) m.downloadTotal.Add(size)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/manager.go
m.uploadTemp.Add(size) m.uploadTotal.Add(size)
<mask> m.connections.Delete(c.ID()) <mask> } <mask> <mask> func (m *Manager) PushUploaded(size int64) { <mask> atomic.AddInt64(&m.uploadTemp, size) <mask> atomic.AddInt64(&m.uploadTotal, size) <mask> } <mask> <mask> func (m *Manager) PushDownloaded(size int64) { <mask> atomic.AddInt64(&m.downloadTemp, size) <mask> atomic.AddInt64(&m.downloadTotal, size) </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove atomic.AddInt64(&m.downloadTemp, size) atomic.AddInt64(&m.downloadTotal, size) </s> add m.downloadTemp.Add(size) m.downloadTotal.Add(size) </s> remove return atomic.LoadInt64(&m.uploadBlip), atomic.LoadInt64(&m.downloadBlip) </s> add return m.uploadBlip.Load(), m.downloadBlip.Load() </s> remove m.uploadTemp = 0 m.uploadBlip = 0 m.uploadTotal = 0 m.downloadTemp = 0 m.downloadBlip = 0 m.downloadTotal = 0 </s> add m.uploadTemp.Store(0) m.uploadBlip.Store(0) m.uploadTotal.Store(0) m.downloadTemp.Store(0) m.downloadBlip.Store(0) m.downloadTotal.Store(0) </s> remove UploadTotal: atomic.LoadInt64(&m.uploadTotal), DownloadTotal: atomic.LoadInt64(&m.downloadTotal), </s> add UploadTotal: m.uploadTotal.Load(), DownloadTotal: m.downloadTotal.Load(), </s> remove atomic.StoreInt64(&m.uploadBlip, atomic.LoadInt64(&m.uploadTemp)) atomic.StoreInt64(&m.uploadTemp, 0) atomic.StoreInt64(&m.downloadBlip, atomic.LoadInt64(&m.downloadTemp)) atomic.StoreInt64(&m.downloadTemp, 0) </s> add m.uploadBlip.Store(m.uploadTemp.Load()) m.uploadTemp.Store(0) m.downloadBlip.Store(m.downloadTemp.Load()) m.downloadTemp.Store(0)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/manager.go
m.downloadTemp.Add(size) m.downloadTotal.Add(size)
<mask> atomic.AddInt64(&m.uploadTotal, size) <mask> } <mask> <mask> func (m *Manager) PushDownloaded(size int64) { <mask> atomic.AddInt64(&m.downloadTemp, size) <mask> atomic.AddInt64(&m.downloadTotal, size) <mask> } <mask> <mask> func (m *Manager) Now() (up int64, down int64) { <mask> return atomic.LoadInt64(&m.uploadBlip), atomic.LoadInt64(&m.downloadBlip) <mask> } </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove atomic.AddInt64(&m.uploadTemp, size) atomic.AddInt64(&m.uploadTotal, size) </s> add m.uploadTemp.Add(size) m.uploadTotal.Add(size) </s> remove return atomic.LoadInt64(&m.uploadBlip), atomic.LoadInt64(&m.downloadBlip) </s> add return m.uploadBlip.Load(), m.downloadBlip.Load() </s> remove m.uploadTemp = 0 m.uploadBlip = 0 m.uploadTotal = 0 m.downloadTemp = 0 m.downloadBlip = 0 m.downloadTotal = 0 </s> add m.uploadTemp.Store(0) m.uploadBlip.Store(0) m.uploadTotal.Store(0) m.downloadTemp.Store(0) m.downloadBlip.Store(0) m.downloadTotal.Store(0) </s> remove UploadTotal: atomic.LoadInt64(&m.uploadTotal), DownloadTotal: atomic.LoadInt64(&m.downloadTotal), </s> add UploadTotal: m.uploadTotal.Load(), DownloadTotal: m.downloadTotal.Load(), </s> remove atomic.StoreInt64(&m.uploadBlip, atomic.LoadInt64(&m.uploadTemp)) atomic.StoreInt64(&m.uploadTemp, 0) atomic.StoreInt64(&m.downloadBlip, atomic.LoadInt64(&m.downloadTemp)) atomic.StoreInt64(&m.downloadTemp, 0) </s> add m.uploadBlip.Store(m.uploadTemp.Load()) m.uploadTemp.Store(0) m.downloadBlip.Store(m.downloadTemp.Load()) m.downloadTemp.Store(0)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/manager.go
return m.uploadBlip.Load(), m.downloadBlip.Load()
<mask> atomic.AddInt64(&m.downloadTotal, size) <mask> } <mask> <mask> func (m *Manager) Now() (up int64, down int64) { <mask> return atomic.LoadInt64(&m.uploadBlip), atomic.LoadInt64(&m.downloadBlip) <mask> } <mask> <mask> func (m *Manager) Snapshot() *Snapshot { <mask> connections := []tracker{} <mask> m.connections.Range(func(key, value interface{}) bool { </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove atomic.AddInt64(&m.downloadTemp, size) atomic.AddInt64(&m.downloadTotal, size) </s> add m.downloadTemp.Add(size) m.downloadTotal.Add(size) </s> remove atomic.AddInt64(&m.uploadTemp, size) atomic.AddInt64(&m.uploadTotal, size) </s> add m.uploadTemp.Add(size) m.uploadTotal.Add(size) </s> remove m.uploadTemp = 0 m.uploadBlip = 0 m.uploadTotal = 0 m.downloadTemp = 0 m.downloadBlip = 0 m.downloadTotal = 0 </s> add m.uploadTemp.Store(0) m.uploadBlip.Store(0) m.uploadTotal.Store(0) m.downloadTemp.Store(0) m.downloadBlip.Store(0) m.downloadTotal.Store(0) </s> remove UploadTotal: atomic.LoadInt64(&m.uploadTotal), DownloadTotal: atomic.LoadInt64(&m.downloadTotal), </s> add UploadTotal: m.uploadTotal.Load(), DownloadTotal: m.downloadTotal.Load(), </s> remove uploadTemp int64 downloadTemp int64 uploadBlip int64 downloadBlip int64 uploadTotal int64 downloadTotal int64 </s> add uploadTemp *atomic.Int64 downloadTemp *atomic.Int64 uploadBlip *atomic.Int64 downloadBlip *atomic.Int64 uploadTotal *atomic.Int64 downloadTotal *atomic.Int64
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/manager.go
UploadTotal: m.uploadTotal.Load(), DownloadTotal: m.downloadTotal.Load(),
<mask> return true <mask> }) <mask> <mask> return &Snapshot{ <mask> UploadTotal: atomic.LoadInt64(&m.uploadTotal), <mask> DownloadTotal: atomic.LoadInt64(&m.downloadTotal), <mask> Connections: connections, <mask> } <mask> } <mask> <mask> func (m *Manager) ResetStatistic() { </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove return atomic.LoadInt64(&m.uploadBlip), atomic.LoadInt64(&m.downloadBlip) </s> add return m.uploadBlip.Load(), m.downloadBlip.Load() </s> remove atomic.AddInt64(&m.downloadTemp, size) atomic.AddInt64(&m.downloadTotal, size) </s> add m.downloadTemp.Add(size) m.downloadTotal.Add(size) </s> remove m.uploadTemp = 0 m.uploadBlip = 0 m.uploadTotal = 0 m.downloadTemp = 0 m.downloadBlip = 0 m.downloadTotal = 0 </s> add m.uploadTemp.Store(0) m.uploadBlip.Store(0) m.uploadTotal.Store(0) m.downloadTemp.Store(0) m.downloadBlip.Store(0) m.downloadTotal.Store(0) </s> remove atomic.AddInt64(&m.uploadTemp, size) atomic.AddInt64(&m.uploadTotal, size) </s> add m.uploadTemp.Add(size) m.uploadTotal.Add(size) </s> remove return &Proxy{adapter, queue.New(10), 1} </s> add return &Proxy{adapter, queue.New(10), atomic.NewBool(true)}
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/manager.go
m.uploadTemp.Store(0) m.uploadBlip.Store(0) m.uploadTotal.Store(0) m.downloadTemp.Store(0) m.downloadBlip.Store(0) m.downloadTotal.Store(0)
<mask> } <mask> } <mask> <mask> func (m *Manager) ResetStatistic() { <mask> m.uploadTemp = 0 <mask> m.uploadBlip = 0 <mask> m.uploadTotal = 0 <mask> m.downloadTemp = 0 <mask> m.downloadBlip = 0 <mask> m.downloadTotal = 0 <mask> } <mask> <mask> func (m *Manager) handle() { <mask> ticker := time.NewTicker(time.Second) <mask> </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove var shardCount int32 = 0 </s> add var shardCount = atomic.NewInt32(0) </s> remove atomic.StoreInt64(&m.uploadBlip, atomic.LoadInt64(&m.uploadTemp)) atomic.StoreInt64(&m.uploadTemp, 0) atomic.StoreInt64(&m.downloadBlip, atomic.LoadInt64(&m.downloadTemp)) atomic.StoreInt64(&m.downloadTemp, 0) </s> add m.uploadBlip.Store(m.uploadTemp.Load()) m.uploadTemp.Store(0) m.downloadBlip.Store(m.downloadTemp.Load()) m.downloadTemp.Store(0) </s> remove if atomic.LoadUint32(&p.alive) == 0 { </s> add if !p.alive.Load() { </s> remove assert.Equal(t, int32(4), shardCount) </s> add assert.Equal(t, int32(4), shardCount.Load())
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/manager.go
m.uploadBlip.Store(m.uploadTemp.Load()) m.uploadTemp.Store(0) m.downloadBlip.Store(m.downloadTemp.Load()) m.downloadTemp.Store(0)
<mask> func (m *Manager) handle() { <mask> ticker := time.NewTicker(time.Second) <mask> <mask> for range ticker.C { <mask> atomic.StoreInt64(&m.uploadBlip, atomic.LoadInt64(&m.uploadTemp)) <mask> atomic.StoreInt64(&m.uploadTemp, 0) <mask> atomic.StoreInt64(&m.downloadBlip, atomic.LoadInt64(&m.downloadTemp)) <mask> atomic.StoreInt64(&m.downloadTemp, 0) <mask> } <mask> } <mask> <mask> type Snapshot struct { <mask> DownloadTotal int64 `json:"downloadTotal"` </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove m.uploadTemp = 0 m.uploadBlip = 0 m.uploadTotal = 0 m.downloadTemp = 0 m.downloadBlip = 0 m.downloadTotal = 0 </s> add m.uploadTemp.Store(0) m.uploadBlip.Store(0) m.uploadTotal.Store(0) m.downloadTemp.Store(0) m.downloadBlip.Store(0) m.downloadTotal.Store(0) </s> remove uploadTemp int64 downloadTemp int64 uploadBlip int64 downloadBlip int64 uploadTotal int64 downloadTotal int64 </s> add uploadTemp *atomic.Int64 downloadTemp *atomic.Int64 uploadBlip *atomic.Int64 downloadBlip *atomic.Int64 uploadTotal *atomic.Int64 downloadTotal *atomic.Int64 </s> remove UUID uuid.UUID `json:"id"` Metadata *C.Metadata `json:"metadata"` UploadTotal int64 `json:"upload"` DownloadTotal int64 `json:"download"` Start time.Time `json:"start"` Chain C.Chain `json:"chains"` Rule string `json:"rule"` RulePayload string `json:"rulePayload"` </s> add UUID uuid.UUID `json:"id"` Metadata *C.Metadata `json:"metadata"` UploadTotal *atomic.Int64 `json:"upload"` DownloadTotal *atomic.Int64 `json:"download"` Start time.Time `json:"start"` Chain C.Chain `json:"chains"` Rule string `json:"rule"` RulePayload string `json:"rulePayload"` </s> remove atomic.StoreUint32(&p.alive, 0) </s> add p.alive.Store(false) </s> remove if err == nil { atomic.StoreUint32(&p.alive, 1) } else { atomic.StoreUint32(&p.alive, 0) } </s> add p.alive.Store(err == nil)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/manager.go
<mask> package tunnel <mask> <mask> import ( <mask> "net" <mask> "sync/atomic" <mask> "time" <mask> <mask> C "github.com/Dreamacro/clash/constant" <mask> "github.com/gofrs/uuid" <mask> ) </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add </s> remove "sync/atomic" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/tracker.go
"go.uber.org/atomic"
<mask> <mask> "github.com/gofrs/uuid" <mask> ) <mask> <mask> type tracker interface { <mask> ID() string <mask> Close() error </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove UUID uuid.UUID `json:"id"` Metadata *C.Metadata `json:"metadata"` UploadTotal int64 `json:"upload"` DownloadTotal int64 `json:"download"` Start time.Time `json:"start"` Chain C.Chain `json:"chains"` Rule string `json:"rule"` RulePayload string `json:"rulePayload"` </s> add UUID uuid.UUID `json:"id"` Metadata *C.Metadata `json:"metadata"` UploadTotal *atomic.Int64 `json:"upload"` DownloadTotal *atomic.Int64 `json:"download"` Start time.Time `json:"start"` Chain C.Chain `json:"chains"` Rule string `json:"rule"` RulePayload string `json:"rulePayload"` </s> remove atomic.AddInt64(&tt.UploadTotal, upload) </s> add tt.UploadTotal.Add(upload) </s> remove "sync/atomic" </s> add </s> remove atomic.AddInt64(&ut.UploadTotal, upload) </s> add ut.UploadTotal.Add(upload)
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/tracker.go
UUID uuid.UUID `json:"id"` Metadata *C.Metadata `json:"metadata"` UploadTotal *atomic.Int64 `json:"upload"` DownloadTotal *atomic.Int64 `json:"download"` Start time.Time `json:"start"` Chain C.Chain `json:"chains"` Rule string `json:"rule"` RulePayload string `json:"rulePayload"`
<mask> Close() error <mask> } <mask> <mask> type trackerInfo struct { <mask> UUID uuid.UUID `json:"id"` <mask> Metadata *C.Metadata `json:"metadata"` <mask> UploadTotal int64 `json:"upload"` <mask> DownloadTotal int64 `json:"download"` <mask> Start time.Time `json:"start"` <mask> Chain C.Chain `json:"chains"` <mask> Rule string `json:"rule"` <mask> RulePayload string `json:"rulePayload"` <mask> } <mask> <mask> type tcpTracker struct { <mask> C.Conn `json:"-"` <mask> *trackerInfo </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove uploadTemp int64 downloadTemp int64 uploadBlip int64 downloadBlip int64 uploadTotal int64 downloadTotal int64 </s> add uploadTemp *atomic.Int64 downloadTemp *atomic.Int64 uploadBlip *atomic.Int64 downloadBlip *atomic.Int64 uploadTotal *atomic.Int64 downloadTotal *atomic.Int64 </s> remove atomic.StoreInt64(&m.uploadBlip, atomic.LoadInt64(&m.uploadTemp)) atomic.StoreInt64(&m.uploadTemp, 0) atomic.StoreInt64(&m.downloadBlip, atomic.LoadInt64(&m.downloadTemp)) atomic.StoreInt64(&m.downloadTemp, 0) </s> add m.uploadBlip.Store(m.uploadTemp.Load()) m.uploadTemp.Store(0) m.downloadBlip.Store(m.downloadTemp.Load()) m.downloadTemp.Store(0) </s> remove alive uint32 </s> add alive *atomic.Bool
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/tracker.go
tt.DownloadTotal.Add(download)
<mask> func (tt *tcpTracker) Read(b []byte) (int, error) { <mask> n, err := tt.Conn.Read(b) <mask> download := int64(n) <mask> tt.manager.PushDownloaded(download) <mask> atomic.AddInt64(&tt.DownloadTotal, download) <mask> return n, err <mask> } <mask> <mask> func (tt *tcpTracker) Write(b []byte) (int, error) { <mask> n, err := tt.Conn.Write(b) </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove atomic.AddInt64(&tt.UploadTotal, upload) </s> add tt.UploadTotal.Add(upload) </s> remove atomic.AddInt64(&ut.DownloadTotal, download) </s> add ut.DownloadTotal.Add(download) </s> remove atomic.AddInt64(&ut.UploadTotal, upload) </s> add ut.UploadTotal.Add(upload) </s> remove atomic.StoreUint32(&p.alive, 0) </s> add p.alive.Store(false) </s> remove if err == nil { atomic.StoreUint32(&p.alive, 1) } else { atomic.StoreUint32(&p.alive, 0) } </s> add p.alive.Store(err == nil)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/tracker.go
tt.UploadTotal.Add(upload)
<mask> func (tt *tcpTracker) Write(b []byte) (int, error) { <mask> n, err := tt.Conn.Write(b) <mask> upload := int64(n) <mask> tt.manager.PushUploaded(upload) <mask> atomic.AddInt64(&tt.UploadTotal, upload) <mask> return n, err <mask> } <mask> <mask> func (tt *tcpTracker) Close() error { <mask> tt.manager.Leave(tt) </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove atomic.AddInt64(&tt.DownloadTotal, download) </s> add tt.DownloadTotal.Add(download) </s> remove atomic.AddInt64(&ut.UploadTotal, upload) </s> add ut.UploadTotal.Add(upload) </s> remove atomic.AddInt64(&ut.DownloadTotal, download) </s> add ut.DownloadTotal.Add(download) </s> remove atomic.StoreUint32(&p.alive, 0) </s> add p.alive.Store(false) </s> remove if err == nil { atomic.StoreUint32(&p.alive, 1) } else { atomic.StoreUint32(&p.alive, 0) } </s> add p.alive.Store(err == nil)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/tracker.go
UUID: uuid, Start: time.Now(), Metadata: metadata, Chain: conn.Chains(), Rule: "", UploadTotal: atomic.NewInt64(0), DownloadTotal: atomic.NewInt64(0),
<mask> t := &tcpTracker{ <mask> Conn: conn, <mask> manager: manager, <mask> trackerInfo: &trackerInfo{ <mask> UUID: uuid, <mask> Start: time.Now(), <mask> Metadata: metadata, <mask> Chain: conn.Chains(), <mask> Rule: "", <mask> }, <mask> } <mask> <mask> if rule != nil { <mask> t.trackerInfo.Rule = rule.RuleType().String() </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove UUID: uuid, Start: time.Now(), Metadata: metadata, Chain: conn.Chains(), Rule: "", </s> add UUID: uuid, Start: time.Now(), Metadata: metadata, Chain: conn.Chains(), Rule: "", UploadTotal: atomic.NewInt64(0), DownloadTotal: atomic.NewInt64(0), </s> remove atomic.StoreUint32(&p.alive, 0) </s> add p.alive.Store(false) </s> remove if err == nil { atomic.StoreUint32(&p.alive, 1) } else { atomic.StoreUint32(&p.alive, 0) } </s> add p.alive.Store(err == nil) </s> remove if atomic.LoadUint32(&p.alive) == 0 { </s> add if !p.alive.Load() { </s> remove var shardCount int32 = 0 </s> add var shardCount = atomic.NewInt32(0)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/tracker.go
ut.DownloadTotal.Add(download)
<mask> func (ut *udpTracker) ReadFrom(b []byte) (int, net.Addr, error) { <mask> n, addr, err := ut.PacketConn.ReadFrom(b) <mask> download := int64(n) <mask> ut.manager.PushDownloaded(download) <mask> atomic.AddInt64(&ut.DownloadTotal, download) <mask> return n, addr, err <mask> } <mask> <mask> func (ut *udpTracker) WriteTo(b []byte, addr net.Addr) (int, error) { <mask> n, err := ut.PacketConn.WriteTo(b, addr) </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove atomic.AddInt64(&ut.UploadTotal, upload) </s> add ut.UploadTotal.Add(upload) </s> remove atomic.AddInt64(&tt.DownloadTotal, download) </s> add tt.DownloadTotal.Add(download) </s> remove atomic.AddInt64(&tt.UploadTotal, upload) </s> add tt.UploadTotal.Add(upload) </s> remove atomic.StoreUint32(&p.alive, 0) </s> add p.alive.Store(false) </s> remove if err == nil { atomic.StoreUint32(&p.alive, 1) } else { atomic.StoreUint32(&p.alive, 0) } </s> add p.alive.Store(err == nil)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/tracker.go
ut.UploadTotal.Add(upload)
<mask> func (ut *udpTracker) WriteTo(b []byte, addr net.Addr) (int, error) { <mask> n, err := ut.PacketConn.WriteTo(b, addr) <mask> upload := int64(n) <mask> ut.manager.PushUploaded(upload) <mask> atomic.AddInt64(&ut.UploadTotal, upload) <mask> return n, err <mask> } <mask> <mask> func (ut *udpTracker) Close() error { <mask> ut.manager.Leave(ut) </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove atomic.AddInt64(&ut.DownloadTotal, download) </s> add ut.DownloadTotal.Add(download) </s> remove atomic.AddInt64(&tt.UploadTotal, upload) </s> add tt.UploadTotal.Add(upload) </s> remove atomic.AddInt64(&tt.DownloadTotal, download) </s> add tt.DownloadTotal.Add(download) </s> remove atomic.StoreUint32(&p.alive, 0) </s> add p.alive.Store(false) </s> remove if err == nil { atomic.StoreUint32(&p.alive, 1) } else { atomic.StoreUint32(&p.alive, 0) } </s> add p.alive.Store(err == nil)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/tracker.go
UUID: uuid, Start: time.Now(), Metadata: metadata, Chain: conn.Chains(), Rule: "", UploadTotal: atomic.NewInt64(0), DownloadTotal: atomic.NewInt64(0),
<mask> ut := &udpTracker{ <mask> PacketConn: conn, <mask> manager: manager, <mask> trackerInfo: &trackerInfo{ <mask> UUID: uuid, <mask> Start: time.Now(), <mask> Metadata: metadata, <mask> Chain: conn.Chains(), <mask> Rule: "", <mask> }, <mask> } <mask> <mask> if rule != nil { <mask> ut.trackerInfo.Rule = rule.RuleType().String() </s> Fix: tunnel manager & tracker race condition (#1048) </s> remove UUID: uuid, Start: time.Now(), Metadata: metadata, Chain: conn.Chains(), Rule: "", </s> add UUID: uuid, Start: time.Now(), Metadata: metadata, Chain: conn.Chains(), Rule: "", UploadTotal: atomic.NewInt64(0), DownloadTotal: atomic.NewInt64(0), </s> remove atomic.StoreUint32(&p.alive, 0) </s> add p.alive.Store(false) </s> remove if err == nil { atomic.StoreUint32(&p.alive, 1) } else { atomic.StoreUint32(&p.alive, 0) } </s> add p.alive.Store(err == nil) </s> remove if atomic.LoadUint32(&p.alive) == 0 { </s> add if !p.alive.Load() { </s> remove var shardCount int32 = 0 </s> add var shardCount = atomic.NewInt32(0)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/87e4d9429098fcf2421713641426b88256d1decc
tunnel/tracker.go
Hosts *trie.DomainTrie
<mask> DefaultNameserver []dns.NameServer `yaml:"default-nameserver"` <mask> FakeIPRange *fakeip.Pool <mask> } <mask> <mask> // FallbackFilter config <mask> type FallbackFilter struct { <mask> GeoIP bool `yaml:"geoip"` </s> Feature: dns server could lookup hosts (#872)
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
config/config.go
UseHosts bool `yaml:"use-hosts"`
<mask> <mask> type RawDNS struct { <mask> Enable bool `yaml:"enable"` <mask> IPv6 bool `yaml:"ipv6"` <mask> NameServer []string `yaml:"nameserver"` <mask> Fallback []string `yaml:"fallback"` <mask> FallbackFilter RawFallbackFilter `yaml:"fallback-filter"` <mask> Listen string `yaml:"listen"` <mask> EnhancedMode dns.EnhancedMode `yaml:"enhanced-mode"` </s> Feature: dns server could lookup hosts (#872) </s> remove func parseDNS(cfg RawDNS) (*DNS, error) { </s> add func parseDNS(cfg RawDNS, hosts *trie.DomainTrie) (*DNS, error) {
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
config/config.go
UseHosts: true,
<mask> ProxyGroup: []map[string]interface{}{}, <mask> DNS: RawDNS{ <mask> Enable: false, <mask> FakeIPRange: "198.18.0.1/16", <mask> FallbackFilter: RawFallbackFilter{ <mask> GeoIP: true, <mask> IPCIDR: []string{}, </s> Feature: dns server could lookup hosts (#872) </s> remove func parseDNS(cfg RawDNS) (*DNS, error) { </s> add func parseDNS(cfg RawDNS, hosts *trie.DomainTrie) (*DNS, error) { </s> remove dnsCfg, err := parseDNS(rawCfg.DNS) </s> add hosts, err := parseHosts(rawCfg) </s> remove config.DNS = dnsCfg </s> add config.Hosts = hosts
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
config/config.go
hosts, err := parseHosts(rawCfg)
<mask> return nil, err <mask> } <mask> config.Rules = rules <mask> <mask> dnsCfg, err := parseDNS(rawCfg.DNS) <mask> if err != nil { <mask> return nil, err <mask> } <mask> config.DNS = dnsCfg <mask> </s> Feature: dns server could lookup hosts (#872) </s> remove config.DNS = dnsCfg </s> add config.Hosts = hosts </s> remove hosts, err := parseHosts(rawCfg) </s> add dnsCfg, err := parseDNS(rawCfg.DNS, hosts) </s> remove config.Hosts = hosts </s> add config.DNS = dnsCfg
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
config/config.go
config.Hosts = hosts
<mask> dnsCfg, err := parseDNS(rawCfg.DNS) <mask> if err != nil { <mask> return nil, err <mask> } <mask> config.DNS = dnsCfg <mask> <mask> hosts, err := parseHosts(rawCfg) <mask> if err != nil { <mask> return nil, err <mask> } </s> Feature: dns server could lookup hosts (#872) </s> remove dnsCfg, err := parseDNS(rawCfg.DNS) </s> add hosts, err := parseHosts(rawCfg) </s> remove hosts, err := parseHosts(rawCfg) </s> add dnsCfg, err := parseDNS(rawCfg.DNS, hosts) </s> remove config.Hosts = hosts </s> add config.DNS = dnsCfg
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
config/config.go
dnsCfg, err := parseDNS(rawCfg.DNS, hosts)
<mask> return nil, err <mask> } <mask> config.DNS = dnsCfg <mask> <mask> hosts, err := parseHosts(rawCfg) <mask> if err != nil { <mask> return nil, err <mask> } <mask> config.Hosts = hosts <mask> </s> Feature: dns server could lookup hosts (#872) </s> remove config.DNS = dnsCfg </s> add config.Hosts = hosts </s> remove config.Hosts = hosts </s> add config.DNS = dnsCfg </s> remove dnsCfg, err := parseDNS(rawCfg.DNS) </s> add hosts, err := parseHosts(rawCfg) </s> remove func parseDNS(cfg RawDNS) (*DNS, error) { </s> add func parseDNS(cfg RawDNS, hosts *trie.DomainTrie) (*DNS, error) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
config/config.go
config.DNS = dnsCfg
<mask> hosts, err := parseHosts(rawCfg) <mask> if err != nil { <mask> return nil, err <mask> } <mask> config.Hosts = hosts <mask> <mask> config.Users = parseAuthentication(rawCfg.Authentication) <mask> <mask> return config, nil <mask> } </s> Feature: dns server could lookup hosts (#872) </s> remove config.DNS = dnsCfg </s> add config.Hosts = hosts </s> remove hosts, err := parseHosts(rawCfg) </s> add dnsCfg, err := parseDNS(rawCfg.DNS, hosts) </s> remove dnsCfg, err := parseDNS(rawCfg.DNS) </s> add hosts, err := parseHosts(rawCfg)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
config/config.go
func parseDNS(cfg RawDNS, hosts *trie.DomainTrie) (*DNS, error) {
<mask> <mask> return ipNets, nil <mask> } <mask> <mask> func parseDNS(cfg RawDNS) (*DNS, error) { <mask> if cfg.Enable && len(cfg.NameServer) == 0 { <mask> return nil, fmt.Errorf("If DNS configuration is turned on, NameServer cannot be empty") <mask> } <mask> <mask> dnsCfg := &DNS{ </s> Feature: dns server could lookup hosts (#872) </s> remove config.DNS = dnsCfg </s> add config.Hosts = hosts </s> remove dnsCfg, err := parseDNS(rawCfg.DNS) </s> add hosts, err := parseHosts(rawCfg) </s> remove hosts, err := parseHosts(rawCfg) </s> add dnsCfg, err := parseDNS(rawCfg.DNS, hosts)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
config/config.go
if cfg.UseHosts { dnsCfg.Hosts = hosts }
<mask> if fallbackip, err := parseFallbackIPCIDR(cfg.FallbackFilter.IPCIDR); err == nil { <mask> dnsCfg.FallbackFilter.IPCIDR = fallbackip <mask> } <mask> <mask> return dnsCfg, nil <mask> } <mask> <mask> func parseAuthentication(rawRecords []string) []auth.AuthUser { <mask> users := make([]auth.AuthUser, 0) </s> Feature: dns server could lookup hosts (#872) </s> remove config.DNS = dnsCfg </s> add config.Hosts = hosts </s> remove dnsCfg, err := parseDNS(rawCfg.DNS) </s> add hosts, err := parseHosts(rawCfg) </s> remove hosts, err := parseHosts(rawCfg) </s> add dnsCfg, err := parseDNS(rawCfg.DNS, hosts) </s> remove config.Hosts = hosts </s> add config.DNS = dnsCfg </s> remove func parseDNS(cfg RawDNS) (*DNS, error) { </s> add func parseDNS(cfg RawDNS, hosts *trie.DomainTrie) (*DNS, error) {
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
config/config.go
"net"
<mask> package dns <mask> <mask> import ( <mask> "strings" <mask> <mask> "github.com/Dreamacro/clash/component/fakeip" <mask> "github.com/Dreamacro/clash/component/trie" <mask> "github.com/Dreamacro/clash/log" <mask> </s> Feature: dns server could lookup hosts (#872) </s> remove config.Hosts = hosts </s> add config.DNS = dnsCfg
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
dns/middleware.go
"github.com/Dreamacro/clash/component/trie"
<mask> "strings" <mask> <mask> "github.com/Dreamacro/clash/component/fakeip" <mask> "github.com/Dreamacro/clash/log" <mask> <mask> D "github.com/miekg/dns" <mask> ) <mask> </s> Feature: dns server could lookup hosts (#872) </s> remove config.Hosts = hosts </s> add config.DNS = dnsCfg
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
dns/middleware.go
if resolver.hosts != nil { middlewares = append(middlewares, withHosts(resolver.hosts)) }
<mask> func newHandler(resolver *Resolver) handler { <mask> middlewares := []middleware{} <mask> <mask> if resolver.FakeIPEnabled() { <mask> middlewares = append(middlewares, withFakeIP(resolver.pool)) <mask> } <mask> <mask> return compose(middlewares, withResolver(resolver)) <mask> } </s> Feature: dns server could lookup hosts (#872) </s> remove func parseDNS(cfg RawDNS) (*DNS, error) { </s> add func parseDNS(cfg RawDNS, hosts *trie.DomainTrie) (*DNS, error) { </s> remove config.DNS = dnsCfg </s> add config.Hosts = hosts </s> remove config.Hosts = hosts </s> add config.DNS = dnsCfg </s> remove dnsCfg, err := parseDNS(rawCfg.DNS) </s> add hosts, err := parseHosts(rawCfg)
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
dns/middleware.go
"github.com/Dreamacro/clash/component/trie"
<mask> "github.com/Dreamacro/clash/common/cache" <mask> "github.com/Dreamacro/clash/common/picker" <mask> "github.com/Dreamacro/clash/component/fakeip" <mask> "github.com/Dreamacro/clash/component/resolver" <mask> <mask> D "github.com/miekg/dns" <mask> "golang.org/x/sync/singleflight" <mask> ) </s> Feature: dns server could lookup hosts (#872) </s> remove config.Hosts = hosts </s> add config.DNS = dnsCfg
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
dns/resolver.go
hosts *trie.DomainTrie
<mask> mapping bool <mask> fakeip bool <mask> pool *fakeip.Pool <mask> main []dnsClient <mask> fallback []dnsClient <mask> fallbackFilters []fallbackFilter <mask> group singleflight.Group </s> Feature: dns server could lookup hosts (#872) </s> remove config.Hosts = hosts </s> add config.DNS = dnsCfg
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
dns/resolver.go
Hosts *trie.DomainTrie
<mask> EnhancedMode EnhancedMode <mask> FallbackFilter FallbackFilter <mask> Pool *fakeip.Pool <mask> } <mask> <mask> func New(config Config) *Resolver { <mask> defaultResolver := &Resolver{ <mask> main: transform(config.Default, nil), </s> Feature: dns server could lookup hosts (#872) </s> remove func parseDNS(cfg RawDNS) (*DNS, error) { </s> add func parseDNS(cfg RawDNS, hosts *trie.DomainTrie) (*DNS, error) {
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
dns/resolver.go
hosts: config.Hosts,
<mask> mapping: config.EnhancedMode == MAPPING, <mask> fakeip: config.EnhancedMode == FAKEIP, <mask> pool: config.Pool, <mask> } <mask> <mask> if len(config.Fallback) != 0 { <mask> r.fallback = transform(config.Fallback, defaultResolver) <mask> } <mask> </s> Feature: dns server could lookup hosts (#872) </s> remove func parseDNS(cfg RawDNS) (*DNS, error) { </s> add func parseDNS(cfg RawDNS, hosts *trie.DomainTrie) (*DNS, error) { </s> remove config.DNS = dnsCfg </s> add config.Hosts = hosts </s> remove config.Hosts = hosts </s> add config.DNS = dnsCfg
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
dns/resolver.go
Hosts: c.Hosts,
<mask> Fallback: c.Fallback, <mask> IPv6: c.IPv6, <mask> EnhancedMode: c.EnhancedMode, <mask> Pool: c.FakeIPRange, <mask> FallbackFilter: dns.FallbackFilter{ <mask> GeoIP: c.FallbackFilter.GeoIP, <mask> IPCIDR: c.FallbackFilter.IPCIDR, <mask> }, <mask> Default: c.DefaultNameserver, <mask> }) </s> Feature: dns server could lookup hosts (#872) </s> remove func parseDNS(cfg RawDNS) (*DNS, error) { </s> add func parseDNS(cfg RawDNS, hosts *trie.DomainTrie) (*DNS, error) { </s> remove dnsCfg, err := parseDNS(rawCfg.DNS) </s> add hosts, err := parseHosts(rawCfg) </s> remove config.DNS = dnsCfg </s> add config.Hosts = hosts
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/89cf06036d5f2ead79ba99528e815070d9c087c6
hub/executor/executor.go
<mask> wg sync.WaitGroup <mask> <mask> once sync.Once <mask> result interface{} <mask> <mask> firstDone chan struct{} <mask> } <mask> <mask> func newPicker(ctx context.Context, cancel func()) *Picker { <mask> return &Picker{ <mask> ctx: ctx, </s> Fix: use the fastest whether the result is successful </s> remove ctx: ctx, cancel: cancel, firstDone: make(chan struct{}, 1), </s> add ctx: ctx, cancel: cancel, </s> remove // WithoutAutoCancel returns a new Picker and an associated Context derived from ctx, // but it wouldn't cancel context when the first element return. func WithoutAutoCancel(ctx context.Context) *Picker { return newPicker(ctx, nil) } </s> add </s> remove // WaitWithoutCancel blocks until the first result return, if timeout will return nil. // The return of this function will not wait for the cancel of context. func (p *Picker) WaitWithoutCancel() interface{} { select { case <-p.firstDone: return p.result case <-p.ctx.Done(): return p.result } } </s> add </s> remove // Please note that miekg/dns ExchangeContext doesn't respond to context cancel. msg, _, err = c.Client.ExchangeContext(ctx, m, c.Address) return </s> add // miekg/dns ExchangeContext doesn't respond to context cancel. // this is a workaround type result struct { msg *D.Msg err error } ch := make(chan result, 1) go func() { msg, _, err := c.Client.ExchangeContext(ctx, m, c.Address) ch <- result{msg, err} }() select { case <-ctx.Done(): return nil, ctx.Err() case ret := <-ch: return ret.msg, ret.err } </s> remove func TestPicker_WaitWithoutAutoCancel(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*60) defer cancel() picker := WithoutAutoCancel(ctx) trigger := false picker.Go(sleepAndSend(ctx, 10, 1)) picker.Go(func() (interface{}, error) { timer := time.NewTimer(time.Millisecond * time.Duration(30)) select { case <-timer.C: trigger = true return 2, nil case <-ctx.Done(): return nil, ctx.Err() } }) elm := picker.WaitWithoutCancel() assert.NotNil(t, elm) assert.Equal(t, elm.(int), 1) elm = picker.Wait() assert.True(t, trigger) assert.Equal(t, elm.(int), 1) } </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8b5e5114266bfc1509ddc9db267af67ec1b69fe1
common/picker/picker.go
ctx: ctx, cancel: cancel,
<mask> } <mask> <mask> func newPicker(ctx context.Context, cancel func()) *Picker { <mask> return &Picker{ <mask> ctx: ctx, <mask> cancel: cancel, <mask> firstDone: make(chan struct{}, 1), <mask> } <mask> } <mask> <mask> // WithContext returns a new Picker and an associated Context derived from ctx. <mask> // and cancel when first element return. </s> Fix: use the fastest whether the result is successful </s> remove // WithoutAutoCancel returns a new Picker and an associated Context derived from ctx, // but it wouldn't cancel context when the first element return. func WithoutAutoCancel(ctx context.Context) *Picker { return newPicker(ctx, nil) } </s> add </s> remove firstDone chan struct{} </s> add </s> remove // WaitWithoutCancel blocks until the first result return, if timeout will return nil. // The return of this function will not wait for the cancel of context. func (p *Picker) WaitWithoutCancel() interface{} { select { case <-p.firstDone: return p.result case <-p.ctx.Done(): return p.result } } </s> add </s> remove // Please note that miekg/dns ExchangeContext doesn't respond to context cancel. msg, _, err = c.Client.ExchangeContext(ctx, m, c.Address) return </s> add // miekg/dns ExchangeContext doesn't respond to context cancel. // this is a workaround type result struct { msg *D.Msg err error } ch := make(chan result, 1) go func() { msg, _, err := c.Client.ExchangeContext(ctx, m, c.Address) ch <- result{msg, err} }() select { case <-ctx.Done(): return nil, ctx.Err() case ret := <-ch: return ret.msg, ret.err } </s> remove func TestPicker_WaitWithoutAutoCancel(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*60) defer cancel() picker := WithoutAutoCancel(ctx) trigger := false picker.Go(sleepAndSend(ctx, 10, 1)) picker.Go(func() (interface{}, error) { timer := time.NewTimer(time.Millisecond * time.Duration(30)) select { case <-timer.C: trigger = true return 2, nil case <-ctx.Done(): return nil, ctx.Err() } }) elm := picker.WaitWithoutCancel() assert.NotNil(t, elm) assert.Equal(t, elm.(int), 1) elm = picker.Wait() assert.True(t, trigger) assert.Equal(t, elm.(int), 1) } </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8b5e5114266bfc1509ddc9db267af67ec1b69fe1
common/picker/picker.go
<mask> ctx, cancel := context.WithTimeout(ctx, timeout) <mask> return newPicker(ctx, cancel), ctx <mask> } <mask> <mask> // WithoutAutoCancel returns a new Picker and an associated Context derived from ctx, <mask> // but it wouldn't cancel context when the first element return. <mask> func WithoutAutoCancel(ctx context.Context) *Picker { <mask> return newPicker(ctx, nil) <mask> } <mask> <mask> // Wait blocks until all function calls from the Go method have returned, <mask> // then returns the first nil error result (if any) from them. <mask> func (p *Picker) Wait() interface{} { <mask> p.wg.Wait() <mask> if p.cancel != nil { </s> Fix: use the fastest whether the result is successful </s> remove ctx: ctx, cancel: cancel, firstDone: make(chan struct{}, 1), </s> add ctx: ctx, cancel: cancel, </s> remove // WaitWithoutCancel blocks until the first result return, if timeout will return nil. // The return of this function will not wait for the cancel of context. func (p *Picker) WaitWithoutCancel() interface{} { select { case <-p.firstDone: return p.result case <-p.ctx.Done(): return p.result } } </s> add </s> remove // Please note that miekg/dns ExchangeContext doesn't respond to context cancel. msg, _, err = c.Client.ExchangeContext(ctx, m, c.Address) return </s> add // miekg/dns ExchangeContext doesn't respond to context cancel. // this is a workaround type result struct { msg *D.Msg err error } ch := make(chan result, 1) go func() { msg, _, err := c.Client.ExchangeContext(ctx, m, c.Address) ch <- result{msg, err} }() select { case <-ctx.Done(): return nil, ctx.Err() case ret := <-ch: return ret.msg, ret.err } </s> remove firstDone chan struct{} </s> add </s> remove msg, err := r.ExchangeContext(ctx, m) if err != nil || msg.Rcode != D.RcodeSuccess { return nil, errors.New("resolve error") } return msg, nil </s> add return r.ExchangeContext(ctx, m)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8b5e5114266bfc1509ddc9db267af67ec1b69fe1
common/picker/picker.go
<mask> } <mask> return p.result <mask> } <mask> <mask> // WaitWithoutCancel blocks until the first result return, if timeout will return nil. <mask> // The return of this function will not wait for the cancel of context. <mask> func (p *Picker) WaitWithoutCancel() interface{} { <mask> select { <mask> case <-p.firstDone: <mask> return p.result <mask> case <-p.ctx.Done(): <mask> return p.result <mask> } <mask> } <mask> <mask> // Go calls the given function in a new goroutine. <mask> // The first call to return a nil error cancels the group; its result will be returned by Wait. <mask> func (p *Picker) Go(f func() (interface{}, error)) { <mask> p.wg.Add(1) <mask> </s> Fix: use the fastest whether the result is successful </s> remove // WithoutAutoCancel returns a new Picker and an associated Context derived from ctx, // but it wouldn't cancel context when the first element return. func WithoutAutoCancel(ctx context.Context) *Picker { return newPicker(ctx, nil) } </s> add </s> remove // Please note that miekg/dns ExchangeContext doesn't respond to context cancel. msg, _, err = c.Client.ExchangeContext(ctx, m, c.Address) return </s> add // miekg/dns ExchangeContext doesn't respond to context cancel. // this is a workaround type result struct { msg *D.Msg err error } ch := make(chan result, 1) go func() { msg, _, err := c.Client.ExchangeContext(ctx, m, c.Address) ch <- result{msg, err} }() select { case <-ctx.Done(): return nil, ctx.Err() case ret := <-ch: return ret.msg, ret.err } </s> remove ctx: ctx, cancel: cancel, firstDone: make(chan struct{}, 1), </s> add ctx: ctx, cancel: cancel, </s> remove func TestPicker_WaitWithoutAutoCancel(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*60) defer cancel() picker := WithoutAutoCancel(ctx) trigger := false picker.Go(sleepAndSend(ctx, 10, 1)) picker.Go(func() (interface{}, error) { timer := time.NewTimer(time.Millisecond * time.Duration(30)) select { case <-timer.C: trigger = true return 2, nil case <-ctx.Done(): return nil, ctx.Err() } }) elm := picker.WaitWithoutCancel() assert.NotNil(t, elm) assert.Equal(t, elm.(int), 1) elm = picker.Wait() assert.True(t, trigger) assert.Equal(t, elm.(int), 1) } </s> add </s> remove firstDone chan struct{} </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8b5e5114266bfc1509ddc9db267af67ec1b69fe1
common/picker/picker.go
<mask> <mask> if ret, err := f(); err == nil { <mask> p.once.Do(func() { <mask> p.result = ret <mask> p.firstDone <- struct{}{} <mask> if p.cancel != nil { <mask> p.cancel() <mask> } <mask> }) <mask> } </s> Fix: use the fastest whether the result is successful </s> remove msg, err := r.ExchangeContext(ctx, m) if err != nil || msg.Rcode != D.RcodeSuccess { return nil, errors.New("resolve error") } return msg, nil </s> add return r.ExchangeContext(ctx, m) </s> remove // Please note that miekg/dns ExchangeContext doesn't respond to context cancel. msg, _, err = c.Client.ExchangeContext(ctx, m, c.Address) return </s> add // miekg/dns ExchangeContext doesn't respond to context cancel. // this is a workaround type result struct { msg *D.Msg err error } ch := make(chan result, 1) go func() { msg, _, err := c.Client.ExchangeContext(ctx, m, c.Address) ch <- result{msg, err} }() select { case <-ctx.Done(): return nil, ctx.Err() case ret := <-ch: return ret.msg, ret.err } </s> remove if len(ips) == 0 { </s> add ipLength := len(ips) if ipLength == 0 { </s> remove elm := fast.WaitWithoutCancel() </s> add elm := fast.Wait() </s> remove // WithoutAutoCancel returns a new Picker and an associated Context derived from ctx, // but it wouldn't cancel context when the first element return. func WithoutAutoCancel(ctx context.Context) *Picker { return newPicker(ctx, nil) } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8b5e5114266bfc1509ddc9db267af67ec1b69fe1
common/picker/picker.go
<mask> <mask> number := picker.Wait() <mask> assert.Nil(t, number) <mask> } <mask> <mask> func TestPicker_WaitWithoutAutoCancel(t *testing.T) { <mask> ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*60) <mask> defer cancel() <mask> picker := WithoutAutoCancel(ctx) <mask> <mask> trigger := false <mask> picker.Go(sleepAndSend(ctx, 10, 1)) <mask> picker.Go(func() (interface{}, error) { <mask> timer := time.NewTimer(time.Millisecond * time.Duration(30)) <mask> select { <mask> case <-timer.C: <mask> trigger = true <mask> return 2, nil <mask> case <-ctx.Done(): <mask> return nil, ctx.Err() <mask> } <mask> }) <mask> elm := picker.WaitWithoutCancel() <mask> <mask> assert.NotNil(t, elm) <mask> assert.Equal(t, elm.(int), 1) <mask> <mask> elm = picker.Wait() <mask> assert.True(t, trigger) <mask> assert.Equal(t, elm.(int), 1) <mask> } </s> Fix: use the fastest whether the result is successful </s> remove // Please note that miekg/dns ExchangeContext doesn't respond to context cancel. msg, _, err = c.Client.ExchangeContext(ctx, m, c.Address) return </s> add // miekg/dns ExchangeContext doesn't respond to context cancel. // this is a workaround type result struct { msg *D.Msg err error } ch := make(chan result, 1) go func() { msg, _, err := c.Client.ExchangeContext(ctx, m, c.Address) ch <- result{msg, err} }() select { case <-ctx.Done(): return nil, ctx.Err() case ret := <-ch: return ret.msg, ret.err } </s> remove msg, err := r.ExchangeContext(ctx, m) if err != nil || msg.Rcode != D.RcodeSuccess { return nil, errors.New("resolve error") } return msg, nil </s> add return r.ExchangeContext(ctx, m) </s> remove elm := fast.WaitWithoutCancel() </s> add elm := fast.Wait() </s> remove msg.SetReply(r) </s> add msg.SetRcode(r, msg.Rcode) msg.Authoritative = true </s> remove if len(ips) == 0 { </s> add ipLength := len(ips) if ipLength == 0 {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "re...
https://github.com/Dreamacro/clash/commit/8b5e5114266bfc1509ddc9db267af67ec1b69fe1
common/picker/picker_test.go
// miekg/dns ExchangeContext doesn't respond to context cancel. // this is a workaround type result struct { msg *D.Msg err error } ch := make(chan result, 1) go func() { msg, _, err := c.Client.ExchangeContext(ctx, m, c.Address) ch <- result{msg, err} }() select { case <-ctx.Done(): return nil, ctx.Err() case ret := <-ch: return ret.msg, ret.err }
<mask> <mask> func (c *client) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D.Msg, err error) { <mask> c.Client.Dialer = dialer.Dialer() <mask> <mask> // Please note that miekg/dns ExchangeContext doesn't respond to context cancel. <mask> msg, _, err = c.Client.ExchangeContext(ctx, m, c.Address) <mask> return <mask> } </s> Fix: use the fastest whether the result is successful </s> remove msg, err := r.ExchangeContext(ctx, m) if err != nil || msg.Rcode != D.RcodeSuccess { return nil, errors.New("resolve error") } return msg, nil </s> add return r.ExchangeContext(ctx, m) </s> remove ip = ips[0] </s> add ip = ips[rand.Intn(ipLength)] </s> remove p.firstDone <- struct{}{} </s> add </s> remove if len(ips) == 0 { </s> add ipLength := len(ips) if ipLength == 0 { </s> remove elm := fast.WaitWithoutCancel() </s> add elm := fast.Wait()
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep" ]
https://github.com/Dreamacro/clash/commit/8b5e5114266bfc1509ddc9db267af67ec1b69fe1
dns/client.go
msg.SetRcode(r, msg.Rcode) msg.Authoritative = true
<mask> msg := r.Copy() <mask> msg.Answer = []D.RR{rr} <mask> <mask> setMsgTTL(msg, 1) <mask> msg.SetReply(r) <mask> w.WriteMsg(msg) <mask> return <mask> } <mask> } <mask> } </s> Fix: use the fastest whether the result is successful </s> remove msg.SetReply(r) </s> add msg.SetRcode(r, msg.Rcode) msg.Authoritative = true </s> remove elm := fast.WaitWithoutCancel() </s> add elm := fast.Wait() </s> remove func TestPicker_WaitWithoutAutoCancel(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*60) defer cancel() picker := WithoutAutoCancel(ctx) trigger := false picker.Go(sleepAndSend(ctx, 10, 1)) picker.Go(func() (interface{}, error) { timer := time.NewTimer(time.Millisecond * time.Duration(30)) select { case <-timer.C: trigger = true return 2, nil case <-ctx.Done(): return nil, ctx.Err() } }) elm := picker.WaitWithoutCancel() assert.NotNil(t, elm) assert.Equal(t, elm.(int), 1) elm = picker.Wait() assert.True(t, trigger) assert.Equal(t, elm.(int), 1) } </s> add </s> remove // Please note that miekg/dns ExchangeContext doesn't respond to context cancel. msg, _, err = c.Client.ExchangeContext(ctx, m, c.Address) return </s> add // miekg/dns ExchangeContext doesn't respond to context cancel. // this is a workaround type result struct { msg *D.Msg err error } ch := make(chan result, 1) go func() { msg, _, err := c.Client.ExchangeContext(ctx, m, c.Address) ch <- result{msg, err} }() select { case <-ctx.Done(): return nil, ctx.Err() case ret := <-ch: return ret.msg, ret.err } </s> remove if len(ips) == 0 { </s> add ipLength := len(ips) if ipLength == 0 {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8b5e5114266bfc1509ddc9db267af67ec1b69fe1
dns/middleware.go
msg.SetRcode(r, msg.Rcode) msg.Authoritative = true
<mask> log.Debugln("[DNS Server] Exchange %s failed: %v", q.String(), err) <mask> D.HandleFailed(w, r) <mask> return <mask> } <mask> msg.SetReply(r) <mask> w.WriteMsg(msg) <mask> return <mask> } <mask> } <mask> </s> Fix: use the fastest whether the result is successful </s> remove msg.SetReply(r) </s> add msg.SetRcode(r, msg.Rcode) msg.Authoritative = true </s> remove if len(ips) == 0 { </s> add ipLength := len(ips) if ipLength == 0 { </s> remove elm := fast.WaitWithoutCancel() </s> add elm := fast.Wait() </s> remove ip = ips[0] </s> add ip = ips[rand.Intn(ipLength)] </s> remove // WaitWithoutCancel blocks until the first result return, if timeout will return nil. // The return of this function will not wait for the cancel of context. func (p *Picker) WaitWithoutCancel() interface{} { select { case <-p.firstDone: return p.result case <-p.ctx.Done(): return p.result } } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8b5e5114266bfc1509ddc9db267af67ec1b69fe1
dns/middleware.go
"math/rand"
<mask> "crypto/tls" <mask> "errors" <mask> "net" <mask> "strings" <mask> "time" <mask> <mask> "github.com/Dreamacro/clash/common/cache" <mask> "github.com/Dreamacro/clash/common/picker" </s> Fix: use the fastest whether the result is successful </s> remove ip = ips[0] </s> add ip = ips[rand.Intn(ipLength)] </s> remove if len(ips) == 0 { </s> add ipLength := len(ips) if ipLength == 0 { </s> remove elm := fast.WaitWithoutCancel() </s> add elm := fast.Wait() </s> remove msg, err := r.ExchangeContext(ctx, m) if err != nil || msg.Rcode != D.RcodeSuccess { return nil, errors.New("resolve error") } return msg, nil </s> add return r.ExchangeContext(ctx, m) </s> remove msg.SetReply(r) </s> add msg.SetRcode(r, msg.Rcode) msg.Authoritative = true
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8b5e5114266bfc1509ddc9db267af67ec1b69fe1
dns/resolver.go
return r.ExchangeContext(ctx, m)
<mask> fast, ctx := picker.WithTimeout(context.Background(), time.Second*5) <mask> for _, client := range clients { <mask> r := client <mask> fast.Go(func() (interface{}, error) { <mask> msg, err := r.ExchangeContext(ctx, m) <mask> if err != nil || msg.Rcode != D.RcodeSuccess { <mask> return nil, errors.New("resolve error") <mask> } <mask> return msg, nil <mask> }) <mask> } <mask> <mask> elm := fast.WaitWithoutCancel() <mask> if elm == nil { </s> Fix: use the fastest whether the result is successful </s> remove elm := fast.WaitWithoutCancel() </s> add elm := fast.Wait() </s> remove p.firstDone <- struct{}{} </s> add </s> remove // Please note that miekg/dns ExchangeContext doesn't respond to context cancel. msg, _, err = c.Client.ExchangeContext(ctx, m, c.Address) return </s> add // miekg/dns ExchangeContext doesn't respond to context cancel. // this is a workaround type result struct { msg *D.Msg err error } ch := make(chan result, 1) go func() { msg, _, err := c.Client.ExchangeContext(ctx, m, c.Address) ch <- result{msg, err} }() select { case <-ctx.Done(): return nil, ctx.Err() case ret := <-ch: return ret.msg, ret.err } </s> remove func TestPicker_WaitWithoutAutoCancel(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*60) defer cancel() picker := WithoutAutoCancel(ctx) trigger := false picker.Go(sleepAndSend(ctx, 10, 1)) picker.Go(func() (interface{}, error) { timer := time.NewTimer(time.Millisecond * time.Duration(30)) select { case <-timer.C: trigger = true return 2, nil case <-ctx.Done(): return nil, ctx.Err() } }) elm := picker.WaitWithoutCancel() assert.NotNil(t, elm) assert.Equal(t, elm.(int), 1) elm = picker.Wait() assert.True(t, trigger) assert.Equal(t, elm.(int), 1) } </s> add </s> remove if len(ips) == 0 { </s> add ipLength := len(ips) if ipLength == 0 {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8b5e5114266bfc1509ddc9db267af67ec1b69fe1
dns/resolver.go
elm := fast.Wait()
<mask> return msg, nil <mask> }) <mask> } <mask> <mask> elm := fast.WaitWithoutCancel() <mask> if elm == nil { <mask> return nil, errors.New("All DNS requests failed") <mask> } <mask> <mask> msg = elm.(*D.Msg) </s> Fix: use the fastest whether the result is successful </s> remove msg, err := r.ExchangeContext(ctx, m) if err != nil || msg.Rcode != D.RcodeSuccess { return nil, errors.New("resolve error") } return msg, nil </s> add return r.ExchangeContext(ctx, m) </s> remove func TestPicker_WaitWithoutAutoCancel(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*60) defer cancel() picker := WithoutAutoCancel(ctx) trigger := false picker.Go(sleepAndSend(ctx, 10, 1)) picker.Go(func() (interface{}, error) { timer := time.NewTimer(time.Millisecond * time.Duration(30)) select { case <-timer.C: trigger = true return 2, nil case <-ctx.Done(): return nil, ctx.Err() } }) elm := picker.WaitWithoutCancel() assert.NotNil(t, elm) assert.Equal(t, elm.(int), 1) elm = picker.Wait() assert.True(t, trigger) assert.Equal(t, elm.(int), 1) } </s> add </s> remove if len(ips) == 0 { </s> add ipLength := len(ips) if ipLength == 0 { </s> remove // Please note that miekg/dns ExchangeContext doesn't respond to context cancel. msg, _, err = c.Client.ExchangeContext(ctx, m, c.Address) return </s> add // miekg/dns ExchangeContext doesn't respond to context cancel. // this is a workaround type result struct { msg *D.Msg err error } ch := make(chan result, 1) go func() { msg, _, err := c.Client.ExchangeContext(ctx, m, c.Address) ch <- result{msg, err} }() select { case <-ctx.Done(): return nil, ctx.Err() case ret := <-ch: return ret.msg, ret.err } </s> remove ip = ips[0] </s> add ip = ips[rand.Intn(ipLength)]
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8b5e5114266bfc1509ddc9db267af67ec1b69fe1
dns/resolver.go
ipLength := len(ips) if ipLength == 0 {
<mask> return nil, err <mask> } <mask> <mask> ips := r.msgToIP(msg) <mask> if len(ips) == 0 { <mask> return nil, errIPNotFound <mask> } <mask> <mask> ip = ips[0] <mask> return </s> Fix: use the fastest whether the result is successful </s> remove ip = ips[0] </s> add ip = ips[rand.Intn(ipLength)] </s> remove msg, err := r.ExchangeContext(ctx, m) if err != nil || msg.Rcode != D.RcodeSuccess { return nil, errors.New("resolve error") } return msg, nil </s> add return r.ExchangeContext(ctx, m) </s> remove elm := fast.WaitWithoutCancel() </s> add elm := fast.Wait() </s> remove // Please note that miekg/dns ExchangeContext doesn't respond to context cancel. msg, _, err = c.Client.ExchangeContext(ctx, m, c.Address) return </s> add // miekg/dns ExchangeContext doesn't respond to context cancel. // this is a workaround type result struct { msg *D.Msg err error } ch := make(chan result, 1) go func() { msg, _, err := c.Client.ExchangeContext(ctx, m, c.Address) ch <- result{msg, err} }() select { case <-ctx.Done(): return nil, ctx.Err() case ret := <-ch: return ret.msg, ret.err } </s> remove p.firstDone <- struct{}{} </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8b5e5114266bfc1509ddc9db267af67ec1b69fe1
dns/resolver.go
ip = ips[rand.Intn(ipLength)]
<mask> if len(ips) == 0 { <mask> return nil, errIPNotFound <mask> } <mask> <mask> ip = ips[0] <mask> return <mask> } <mask> <mask> func (r *Resolver) msgToIP(msg *D.Msg) []net.IP { <mask> ips := []net.IP{} </s> Fix: use the fastest whether the result is successful </s> remove if len(ips) == 0 { </s> add ipLength := len(ips) if ipLength == 0 { </s> remove elm := fast.WaitWithoutCancel() </s> add elm := fast.Wait() </s> remove // Please note that miekg/dns ExchangeContext doesn't respond to context cancel. msg, _, err = c.Client.ExchangeContext(ctx, m, c.Address) return </s> add // miekg/dns ExchangeContext doesn't respond to context cancel. // this is a workaround type result struct { msg *D.Msg err error } ch := make(chan result, 1) go func() { msg, _, err := c.Client.ExchangeContext(ctx, m, c.Address) ch <- result{msg, err} }() select { case <-ctx.Done(): return nil, ctx.Err() case ret := <-ch: return ret.msg, ret.err } </s> remove msg, err := r.ExchangeContext(ctx, m) if err != nil || msg.Rcode != D.RcodeSuccess { return nil, errors.New("resolve error") } return msg, nil </s> add return r.ExchangeContext(ctx, m) </s> remove func TestPicker_WaitWithoutAutoCancel(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*60) defer cancel() picker := WithoutAutoCancel(ctx) trigger := false picker.Go(sleepAndSend(ctx, 10, 1)) picker.Go(func() (interface{}, error) { timer := time.NewTimer(time.Millisecond * time.Duration(30)) select { case <-timer.C: trigger = true return 2, nil case <-ctx.Done(): return nil, ctx.Err() } }) elm := picker.WaitWithoutCancel() assert.NotNil(t, elm) assert.Equal(t, elm.(int), 1) elm = picker.Wait() assert.True(t, trigger) assert.Equal(t, elm.(int), 1) } </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8b5e5114266bfc1509ddc9db267af67ec1b69fe1
dns/resolver.go
Mode string `obfs:"mode"` Host string `obfs:"host,omitempty"` Path string `obfs:"path,omitempty"` TLS bool `obfs:"tls,omitempty"` Headers map[string]string `obfs:"headers,omitempty"` SkipCertVerify bool `obfs:"skip-cert-verify,omitempty"`
<mask> Host string `obfs:"host,omitempty"` <mask> } <mask> <mask> type v2rayObfsOption struct { <mask> Mode string `obfs:"mode"` <mask> Host string `obfs:"host,omitempty"` <mask> Path string `obfs:"path,omitempty"` <mask> TLS bool `obfs:"tls,omitempty"` <mask> SkipCertVerify bool `obfs:"skip-cert-verify,omitempty"` <mask> } <mask> <mask> func (ss *ShadowSocks) Dial(metadata *C.Metadata) (net.Conn, error) { <mask> c, err := net.DialTimeout("tcp", ss.server, tcpTimeout) <mask> if err != nil { </s> Feature: add custom headers support in v2ray-plugin (#137)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c608f5d7a5b701320c96d7d5c193c121bfad026
adapters/outbound/shadowsocks.go
Headers: opts.Headers,
<mask> wsOption = &v2rayObfs.WebsocketOption{ <mask> Host: opts.Host, <mask> Path: opts.Path, <mask> TLSConfig: tlsConfig, <mask> } <mask> } <mask> </s> Feature: add custom headers support in v2ray-plugin (#137) </s> remove Mode string `obfs:"mode"` Host string `obfs:"host,omitempty"` Path string `obfs:"path,omitempty"` TLS bool `obfs:"tls,omitempty"` SkipCertVerify bool `obfs:"skip-cert-verify,omitempty"` </s> add Mode string `obfs:"mode"` Host string `obfs:"host,omitempty"` Path string `obfs:"path,omitempty"` TLS bool `obfs:"tls,omitempty"` Headers map[string]string `obfs:"headers,omitempty"` SkipCertVerify bool `obfs:"skip-cert-verify,omitempty"`
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c608f5d7a5b701320c96d7d5c193c121bfad026
adapters/outbound/shadowsocks.go
Headers map[string]string
<mask> // WebsocketOption is options of websocket obfs <mask> type WebsocketOption struct { <mask> Host string <mask> Path string <mask> TLSConfig *tls.Config <mask> } <mask> <mask> // NewWebsocketObfs return a HTTPObfs </s> Feature: add custom headers support in v2ray-plugin (#137) </s> remove Mode string `obfs:"mode"` Host string `obfs:"host,omitempty"` Path string `obfs:"path,omitempty"` TLS bool `obfs:"tls,omitempty"` SkipCertVerify bool `obfs:"skip-cert-verify,omitempty"` </s> add Mode string `obfs:"mode"` Host string `obfs:"host,omitempty"` Path string `obfs:"path,omitempty"` TLS bool `obfs:"tls,omitempty"` Headers map[string]string `obfs:"headers,omitempty"` SkipCertVerify bool `obfs:"skip-cert-verify,omitempty"`
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c608f5d7a5b701320c96d7d5c193c121bfad026
component/v2ray-plugin/websocket.go
Headers: option.Headers,
<mask> Path: option.Path, <mask> TLS: option.TLSConfig != nil, <mask> TLSConfig: option.TLSConfig, <mask> } <mask> <mask> var err error <mask> conn, err = vmess.NewWebsocketConn(conn, config) </s> Feature: add custom headers support in v2ray-plugin (#137) </s> remove Mode string `obfs:"mode"` Host string `obfs:"host,omitempty"` Path string `obfs:"path,omitempty"` TLS bool `obfs:"tls,omitempty"` SkipCertVerify bool `obfs:"skip-cert-verify,omitempty"` </s> add Mode string `obfs:"mode"` Host string `obfs:"host,omitempty"` Path string `obfs:"path,omitempty"` TLS bool `obfs:"tls,omitempty"` Headers map[string]string `obfs:"headers,omitempty"` SkipCertVerify bool `obfs:"skip-cert-verify,omitempty"`
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c608f5d7a5b701320c96d7d5c193c121bfad026
component/v2ray-plugin/websocket.go
github.com/containerd/containerd v1.5.8 // indirect
<mask> <mask> require ( <mask> github.com/Dreamacro/go-shadowsocks2 v0.1.7 // indirect <mask> github.com/Microsoft/go-winio v0.5.1 // indirect <mask> github.com/containerd/containerd v1.5.7 // indirect <mask> github.com/davecgh/go-spew v1.1.1 // indirect <mask> github.com/docker/distribution v2.7.1+incompatible // indirect <mask> github.com/docker/go-units v0.4.0 // indirect <mask> github.com/gofrs/uuid v4.2.0+incompatible // indirect <mask> github.com/gogo/protobuf v1.3.2 // indirect </s> Chore: fix docker dependencies security warning </s> remove golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect </s> add golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect </s> remove github.com/opencontainers/image-spec v1.0.1 // indirect </s> add github.com/opencontainers/image-spec v1.0.2 // indirect </s> remove google.golang.org/grpc v1.42.0 // indirect google.golang.org/protobuf v1.26.0 // indirect </s> add google.golang.org/grpc v1.43.0 // indirect google.golang.org/protobuf v1.27.1 // indirect </s> remove github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= github.com/containerd/containerd v1.5.7 h1:rQyoYtj4KddB3bxG6SAqd4+08gePNyJjRqvOIfV3rkM= github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= </s> add github.com/containerd/containerd v1.5.8 h1:NmkCC1/QxyZFBny8JogwLpOy2f+VEbO/f6bV2Mqtwuw= github.com/containerd/containerd v1.5.8/go.mod h1:YdFSv5bTFLpG2HIYmfqDpSYYTDX+mc5qtSuYx1YUb/s=
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c6d0c6757ee39354cfcdeafbf2bd25b9909e8c1
test/go.mod
github.com/opencontainers/image-spec v1.0.2 // indirect
<mask> github.com/insomniacslk/dhcp v0.0.0-20211214070828-5297eed8f489 // indirect <mask> github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect <mask> github.com/morikuni/aec v1.0.0 // indirect <mask> github.com/opencontainers/go-digest v1.0.0 // indirect <mask> github.com/opencontainers/image-spec v1.0.1 // indirect <mask> github.com/oschwald/geoip2-golang v1.5.0 // indirect <mask> github.com/oschwald/maxminddb-golang v1.8.0 // indirect <mask> github.com/pkg/errors v0.9.1 // indirect <mask> github.com/pmezard/go-difflib v1.0.0 // indirect <mask> github.com/sirupsen/logrus v1.8.1 // indirect </s> Chore: fix docker dependencies security warning </s> remove golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect </s> add golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect </s> remove google.golang.org/grpc v1.42.0 // indirect google.golang.org/protobuf v1.26.0 // indirect </s> add google.golang.org/grpc v1.43.0 // indirect google.golang.org/protobuf v1.27.1 // indirect </s> remove github.com/containerd/containerd v1.5.7 // indirect </s> add github.com/containerd/containerd v1.5.8 // indirect </s> remove github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c6d0c6757ee39354cfcdeafbf2bd25b9909e8c1
test/go.mod
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
<mask> golang.org/x/mod v0.4.2 // indirect <mask> golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect <mask> golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect <mask> golang.org/x/text v0.3.6 // indirect <mask> golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect <mask> golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2 // indirect <mask> golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect <mask> google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a // indirect <mask> google.golang.org/grpc v1.42.0 // indirect <mask> google.golang.org/protobuf v1.26.0 // indirect </s> Chore: fix docker dependencies security warning </s> remove google.golang.org/grpc v1.42.0 // indirect google.golang.org/protobuf v1.26.0 // indirect </s> add google.golang.org/grpc v1.43.0 // indirect google.golang.org/protobuf v1.27.1 // indirect </s> remove github.com/opencontainers/image-spec v1.0.1 // indirect </s> add github.com/opencontainers/image-spec v1.0.2 // indirect </s> remove github.com/containerd/containerd v1.5.7 // indirect </s> add github.com/containerd/containerd v1.5.8 // indirect </s> remove golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= </s> add golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M= golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= </s> remove google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= </s> add google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c6d0c6757ee39354cfcdeafbf2bd25b9909e8c1
test/go.mod
google.golang.org/grpc v1.43.0 // indirect google.golang.org/protobuf v1.27.1 // indirect
<mask> golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect <mask> golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2 // indirect <mask> golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect <mask> google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a // indirect <mask> google.golang.org/grpc v1.42.0 // indirect <mask> google.golang.org/protobuf v1.26.0 // indirect <mask> gopkg.in/yaml.v2 v2.4.0 // indirect <mask> gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect <mask> ) </s> Chore: fix docker dependencies security warning </s> remove golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect </s> add golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect </s> remove github.com/opencontainers/image-spec v1.0.1 // indirect </s> add github.com/opencontainers/image-spec v1.0.2 // indirect </s> remove github.com/containerd/containerd v1.5.7 // indirect </s> add github.com/containerd/containerd v1.5.8 // indirect </s> remove golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= </s> add golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M= golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= </s> remove google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= </s> add google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c6d0c6757ee39354cfcdeafbf2bd25b9909e8c1
test/go.mod
github.com/Microsoft/hcsshim v0.8.23/go.mod h1:4zegtUJth7lAvFyc6cH2gGQ5B3OFQim01nnU2M8jKDg=
<mask> github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg38RRsjT5y8= <mask> github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg= <mask> github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00= <mask> github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600= <mask> github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= <mask> github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= <mask> github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= <mask> github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= <mask> github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= <mask> github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= </s> Chore: fix docker dependencies security warning </s> remove google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= </s> add </s> remove google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= </s> add google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= </s> remove golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= </s> add golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M= golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c6d0c6757ee39354cfcdeafbf2bd25b9909e8c1
test/go.sum
github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
<mask> github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= <mask> github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= <mask> github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= <mask> github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= <mask> github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= <mask> github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw= <mask> github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= </s> Chore: fix docker dependencies security warning </s> remove google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= </s> add </s> remove google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= </s> add google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= </s> remove golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= </s> add golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M= golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c6d0c6757ee39354cfcdeafbf2bd25b9909e8c1
test/go.sum
github.com/containerd/containerd v1.4.9/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
<mask> github.com/containerd/containerd v1.4.0-beta.2.0.20200729163537-40b22ef07410/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= <mask> github.com/containerd/containerd v1.4.1/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= <mask> github.com/containerd/containerd v1.4.3/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= <mask> github.com/containerd/containerd v1.5.0-beta.1/go.mod h1:5HfvG1V2FsKesEGQ17k5/T7V960Tmcumvqn8Mc+pCYQ= <mask> github.com/containerd/containerd v1.5.0-beta.3/go.mod h1:/wr9AVtEM7x9c+n0+stptlo/uBBoBORwEx6ardVcmKU= <mask> github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09ZvgqEq8EfBp/m3lcVZIvPHhI= <mask> github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= </s> Chore: fix docker dependencies security warning </s> remove github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= github.com/containerd/containerd v1.5.7 h1:rQyoYtj4KddB3bxG6SAqd4+08gePNyJjRqvOIfV3rkM= github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= </s> add github.com/containerd/containerd v1.5.8 h1:NmkCC1/QxyZFBny8JogwLpOy2f+VEbO/f6bV2Mqtwuw= github.com/containerd/containerd v1.5.8/go.mod h1:YdFSv5bTFLpG2HIYmfqDpSYYTDX+mc5qtSuYx1YUb/s= </s> remove github.com/containerd/containerd v1.5.7 // indirect </s> add github.com/containerd/containerd v1.5.8 // indirect </s> remove google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= </s> add </s> remove google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= </s> add google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c6d0c6757ee39354cfcdeafbf2bd25b9909e8c1
test/go.sum
github.com/containerd/containerd v1.5.8 h1:NmkCC1/QxyZFBny8JogwLpOy2f+VEbO/f6bV2Mqtwuw= github.com/containerd/containerd v1.5.8/go.mod h1:YdFSv5bTFLpG2HIYmfqDpSYYTDX+mc5qtSuYx1YUb/s=
<mask> github.com/containerd/containerd v1.5.0-beta.1/go.mod h1:5HfvG1V2FsKesEGQ17k5/T7V960Tmcumvqn8Mc+pCYQ= <mask> github.com/containerd/containerd v1.5.0-beta.3/go.mod h1:/wr9AVtEM7x9c+n0+stptlo/uBBoBORwEx6ardVcmKU= <mask> github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09ZvgqEq8EfBp/m3lcVZIvPHhI= <mask> github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= <mask> github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= <mask> github.com/containerd/containerd v1.5.7 h1:rQyoYtj4KddB3bxG6SAqd4+08gePNyJjRqvOIfV3rkM= <mask> github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= <mask> github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= <mask> github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= <mask> github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= <mask> github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe/go.mod h1:cECdGN1O8G9bgKTlLhuPJimka6Xb/Gg7vYzCTNVxhvo= <mask> github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7/go.mod h1:kR3BEg7bDFaEddKm54WSmrol1fKWDU1nKYkgrcgZT7Y= </s> Chore: fix docker dependencies security warning </s> remove github.com/containerd/containerd v1.5.7 // indirect </s> add github.com/containerd/containerd v1.5.8 // indirect </s> remove google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= </s> add </s> remove google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= </s> add google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c6d0c6757ee39354cfcdeafbf2bd25b9909e8c1
test/go.sum
github.com/containerd/ttrpc v1.1.0/go.mod h1:XX4ZTnoOId4HklF4edwc4DcqskFZuvXB1Evzy5KFQpQ=
<mask> github.com/containerd/ttrpc v1.0.1/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= <mask> github.com/containerd/ttrpc v1.0.2/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= <mask> github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= <mask> github.com/containerd/typeurl v0.0.0-20190911142611-5eb25027c9fd/go.mod h1:GeKYzf2pQcqv7tJ0AoCuuhtnqhva5LNU3U+OyKxxJpk= <mask> github.com/containerd/typeurl v1.0.1/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg= <mask> github.com/containerd/typeurl v1.0.2/go.mod h1:9trJWW2sRlGub4wZJRTW83VtbOLS6hwcDZXTn6oPz9s= <mask> github.com/containerd/zfs v0.0.0-20200918131355-0a33824f23a2/go.mod h1:8IgZOBdv8fAgXddBT4dBXJPtxyRsejFIpXoklgxgEjw= </s> Chore: fix docker dependencies security warning </s> remove github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= </s> add </s> remove google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= </s> add </s> remove google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= </s> add google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c6d0c6757ee39354cfcdeafbf2bd25b9909e8c1
test/go.sum
<mask> github.com/opencontainers/go-digest v1.0.0-rc1.0.20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= <mask> github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= <mask> github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= <mask> github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= <mask> github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= <mask> github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= <mask> github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= <mask> github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= <mask> github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= <mask> github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= </s> Chore: fix docker dependencies security warning </s> remove github.com/opencontainers/image-spec v1.0.1 // indirect </s> add github.com/opencontainers/image-spec v1.0.2 // indirect </s> remove google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c6d0c6757ee39354cfcdeafbf2bd25b9909e8c1
test/go.sum
github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
<mask> github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= <mask> github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= <mask> github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= <mask> github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= <mask> github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= <mask> github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= </s> Chore: fix docker dependencies security warning </s> remove github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= </s> add </s> remove github.com/opencontainers/image-spec v1.0.1 // indirect </s> add github.com/opencontainers/image-spec v1.0.2 // indirect </s> remove google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= </s> add
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c6d0c6757ee39354cfcdeafbf2bd25b9909e8c1
test/go.sum
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M= golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
<mask> golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= <mask> golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= <mask> golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= <mask> golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= <mask> golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= <mask> golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= <mask> golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= <mask> golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= <mask> golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= <mask> golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= <mask> golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= </s> Chore: fix docker dependencies security warning </s> remove golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect </s> add golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect </s> remove google.golang.org/grpc v1.42.0 // indirect google.golang.org/protobuf v1.26.0 // indirect </s> add google.golang.org/grpc v1.43.0 // indirect google.golang.org/protobuf v1.27.1 // indirect </s> remove google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= </s> add </s> remove google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= </s> add google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c6d0c6757ee39354cfcdeafbf2bd25b9909e8c1
test/go.sum
google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
<mask> google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= <mask> google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= <mask> google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= <mask> google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= <mask> google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= <mask> google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= <mask> google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= <mask> google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= <mask> google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= <mask> google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= <mask> google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= </s> Chore: fix docker dependencies security warning </s> remove google.golang.org/grpc v1.42.0 // indirect google.golang.org/protobuf v1.26.0 // indirect </s> add google.golang.org/grpc v1.43.0 // indirect google.golang.org/protobuf v1.27.1 // indirect </s> remove golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect </s> add golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect </s> remove google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= </s> add </s> remove golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= </s> add golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M= golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c6d0c6757ee39354cfcdeafbf2bd25b9909e8c1
test/go.sum
<mask> google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= <mask> google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= <mask> google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= <mask> google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= <mask> google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= <mask> google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= <mask> gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= <mask> gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= <mask> gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= <mask> gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= </s> Chore: fix docker dependencies security warning </s> remove google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= </s> add google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= </s> remove google.golang.org/grpc v1.42.0 // indirect google.golang.org/protobuf v1.26.0 // indirect </s> add google.golang.org/grpc v1.43.0 // indirect google.golang.org/protobuf v1.27.1 // indirect </s> remove golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect </s> add golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect </s> remove golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= </s> add golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M= golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c6d0c6757ee39354cfcdeafbf2bd25b9909e8c1
test/go.sum
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
<mask> google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= <mask> google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= <mask> google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= <mask> google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= <mask> gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= <mask> gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= <mask> gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= <mask> gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= <mask> gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= <mask> gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= </s> Chore: fix docker dependencies security warning </s> remove google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= </s> add </s> remove google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= </s> add google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= </s> remove google.golang.org/grpc v1.42.0 // indirect google.golang.org/protobuf v1.26.0 // indirect </s> add google.golang.org/grpc v1.43.0 // indirect google.golang.org/protobuf v1.27.1 // indirect </s> remove golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect </s> add golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect </s> remove golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= </s> add golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M= golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8c6d0c6757ee39354cfcdeafbf2bd25b9909e8c1
test/go.sum
"github.com/Dreamacro/clash/component/trie"
<mask> "net" <mask> "sync" <mask> <mask> "github.com/Dreamacro/clash/common/cache" <mask> trie "github.com/Dreamacro/clash/component/domain-trie" <mask> ) <mask> <mask> // Pool is a implementation about fake ip generator without storage <mask> type Pool struct { <mask> max uint32 </s> Feature: domain trie support wildcard alias </s> remove host *trie.Trie </s> add host *trie.DomainTrie </s> remove trie "github.com/Dreamacro/clash/component/domain-trie" </s> add "github.com/Dreamacro/clash/component/trie" </s> remove Hosts *trie.Trie </s> add Hosts *trie.DomainTrie </s> remove func New(ipnet *net.IPNet, size int, host *trie.Trie) (*Pool, error) { </s> add func New(ipnet *net.IPNet, size int, host *trie.DomainTrie) (*Pool, error) { </s> remove "github.com/Dreamacro/clash/config" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8d0c6c6e661e2fc6740bffc9a0ad3a0a2196d0a3
component/fakeip/pool.go
host *trie.DomainTrie
<mask> min uint32 <mask> gateway uint32 <mask> offset uint32 <mask> mux sync.Mutex <mask> host *trie.Trie <mask> cache *cache.LruCache <mask> } <mask> <mask> // Lookup return a fake ip with host <mask> func (p *Pool) Lookup(host string) net.IP { </s> Feature: domain trie support wildcard alias </s> remove trie "github.com/Dreamacro/clash/component/domain-trie" </s> add "github.com/Dreamacro/clash/component/trie" </s> remove var host *trie.Trie </s> add var host *trie.DomainTrie </s> remove func New(ipnet *net.IPNet, size int, host *trie.Trie) (*Pool, error) { </s> add func New(ipnet *net.IPNet, size int, host *trie.DomainTrie) (*Pool, error) { </s> remove "github.com/Dreamacro/clash/config" </s> add </s> remove func parseHosts(cfg *RawConfig) (*trie.Trie, error) { </s> add func parseHosts(cfg *RawConfig) (*trie.DomainTrie, error) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8d0c6c6e661e2fc6740bffc9a0ad3a0a2196d0a3
component/fakeip/pool.go
func New(ipnet *net.IPNet, size int, host *trie.DomainTrie) (*Pool, error) {
<mask> return net.IPv4(byte(v>>24), byte(v>>16), byte(v>>8), byte(v)) <mask> } <mask> <mask> // New return Pool instance <mask> func New(ipnet *net.IPNet, size int, host *trie.Trie) (*Pool, error) { <mask> min := ipToUint(ipnet.IP) + 2 <mask> <mask> ones, bits := ipnet.Mask.Size() <mask> total := 1<<uint(bits-ones) - 2 <mask> </s> Feature: domain trie support wildcard alias </s> remove func parseHosts(cfg *RawConfig) (*trie.Trie, error) { </s> add func parseHosts(cfg *RawConfig) (*trie.DomainTrie, error) { </s> remove var host *trie.Trie </s> add var host *trie.DomainTrie </s> remove host *trie.Trie </s> add host *trie.DomainTrie </s> remove func updateHosts(tree *trie.Trie) { </s> add func updateHosts(tree *trie.DomainTrie) { </s> remove trie "github.com/Dreamacro/clash/component/domain-trie" </s> add "github.com/Dreamacro/clash/component/trie"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8d0c6c6e661e2fc6740bffc9a0ad3a0a2196d0a3
component/fakeip/pool.go
"github.com/Dreamacro/clash/component/trie"
<mask> "errors" <mask> "net" <mask> "strings" <mask> <mask> trie "github.com/Dreamacro/clash/component/domain-trie" <mask> ) <mask> <mask> var ( <mask> // DefaultResolver aim to resolve ip <mask> DefaultResolver Resolver </s> Feature: domain trie support wildcard alias </s> remove trie "github.com/Dreamacro/clash/component/domain-trie" </s> add "github.com/Dreamacro/clash/component/trie" </s> remove var host *trie.Trie </s> add var host *trie.DomainTrie </s> remove "github.com/Dreamacro/clash/config" </s> add </s> remove trie "github.com/Dreamacro/clash/component/domain-trie" </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8d0c6c6e661e2fc6740bffc9a0ad3a0a2196d0a3
component/resolver/resolver.go
<mask> "github.com/Dreamacro/clash/adapters/outbound" <mask> "github.com/Dreamacro/clash/adapters/outboundgroup" <mask> "github.com/Dreamacro/clash/adapters/provider" <mask> "github.com/Dreamacro/clash/component/auth" <mask> trie "github.com/Dreamacro/clash/component/domain-trie" <mask> "github.com/Dreamacro/clash/component/fakeip" <mask> C "github.com/Dreamacro/clash/constant" <mask> "github.com/Dreamacro/clash/dns" <mask> "github.com/Dreamacro/clash/log" <mask> R "github.com/Dreamacro/clash/rules" </s> Feature: domain trie support wildcard alias </s> remove trie "github.com/Dreamacro/clash/component/domain-trie" </s> add </s> remove trie "github.com/Dreamacro/clash/component/domain-trie" </s> add "github.com/Dreamacro/clash/component/trie" </s> remove trie "github.com/Dreamacro/clash/component/domain-trie" </s> add "github.com/Dreamacro/clash/component/trie"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8d0c6c6e661e2fc6740bffc9a0ad3a0a2196d0a3
config/config.go
"github.com/Dreamacro/clash/component/trie"
<mask> "github.com/Dreamacro/clash/adapters/outboundgroup" <mask> "github.com/Dreamacro/clash/adapters/provider" <mask> "github.com/Dreamacro/clash/component/auth" <mask> "github.com/Dreamacro/clash/component/fakeip" <mask> C "github.com/Dreamacro/clash/constant" <mask> "github.com/Dreamacro/clash/dns" <mask> "github.com/Dreamacro/clash/log" <mask> R "github.com/Dreamacro/clash/rules" <mask> T "github.com/Dreamacro/clash/tunnel" </s> Feature: domain trie support wildcard alias </s> remove trie "github.com/Dreamacro/clash/component/domain-trie" </s> add </s> remove trie "github.com/Dreamacro/clash/component/domain-trie" </s> add </s> remove "github.com/Dreamacro/clash/config" </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8d0c6c6e661e2fc6740bffc9a0ad3a0a2196d0a3
config/config.go
Hosts *trie.DomainTrie
<mask> type Config struct { <mask> General *General <mask> DNS *DNS <mask> Experimental *Experimental <mask> Hosts *trie.Trie <mask> Rules []C.Rule <mask> Users []auth.AuthUser <mask> Proxies map[string]C.Proxy <mask> Providers map[string]provider.ProxyProvider <mask> } </s> Feature: domain trie support wildcard alias </s> remove trie "github.com/Dreamacro/clash/component/domain-trie" </s> add "github.com/Dreamacro/clash/component/trie" </s> remove "github.com/Dreamacro/clash/config" </s> add </s> remove var host *trie.Trie </s> add var host *trie.DomainTrie </s> remove host *trie.Trie </s> add host *trie.DomainTrie </s> remove func updateHosts(tree *trie.Trie) { </s> add func updateHosts(tree *trie.DomainTrie) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/Dreamacro/clash/commit/8d0c6c6e661e2fc6740bffc9a0ad3a0a2196d0a3
config/config.go