mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-05-31 12:49:22 +00:00
Refactor rules
This commit is contained in:
parent
52b776b561
commit
aa94cfb876
39 changed files with 816 additions and 918 deletions
|
|
@ -21,7 +21,7 @@ func TestMergeJSON(t *testing.T) {
|
|||
{
|
||||
Type: C.RuleTypeDefault,
|
||||
DefaultOptions: option.DefaultRule{
|
||||
Network: N.NetworkTCP,
|
||||
Network: []string{N.NetworkTCP},
|
||||
Outbound: "direct",
|
||||
},
|
||||
},
|
||||
|
|
@ -42,7 +42,7 @@ func TestMergeJSON(t *testing.T) {
|
|||
{
|
||||
Type: C.RuleTypeDefault,
|
||||
DefaultOptions: option.DefaultRule{
|
||||
Network: N.NetworkUDP,
|
||||
Network: []string{N.NetworkUDP},
|
||||
Outbound: "direct",
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -27,7 +27,12 @@ type slowOpenConn struct {
|
|||
|
||||
func DialSlowContext(dialer *tfo.Dialer, ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error) {
|
||||
if dialer.DisableTFO || N.NetworkName(network) != N.NetworkTCP {
|
||||
return dialer.DialContext(ctx, network, destination.String(), nil)
|
||||
switch N.NetworkName(network) {
|
||||
case N.NetworkTCP, N.NetworkUDP:
|
||||
return dialer.Dialer.DialContext(ctx, network, destination.String())
|
||||
default:
|
||||
return dialer.Dialer.DialContext(ctx, network, destination.AddrString())
|
||||
}
|
||||
}
|
||||
return &slowOpenConn{
|
||||
dialer: dialer,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue