Fix(socks5): fully udp associate support (#233)

This commit is contained in:
X. Jason Lyu
2019-07-25 17:47:39 +08:00
committed by Dreamacro
parent 183e776970
commit 1fd8f690fe
13 changed files with 483 additions and 89 deletions

22
tunnel/session.go Normal file
View File

@ -0,0 +1,22 @@
package tunnel
import (
"sync"
"time"
nat "github.com/Dreamacro/clash/component/nat-table"
)
var (
natTable *nat.Table
natOnce sync.Once
natTimeout = 120 * time.Second
)
func NATInstance() *nat.Table {
natOnce.Do(func() {
natTable = nat.New(natTimeout)
})
return natTable
}