Refactor struct & Add override dialer options
This commit is contained in:
21
outbound/dialer/dialer.go
Normal file
21
outbound/dialer/dialer.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package dialer
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/adapter"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
"github.com/sagernet/sing/common"
|
||||
N "github.com/sagernet/sing/common/network"
|
||||
)
|
||||
|
||||
func New(router adapter.Router, options option.DialerOptions) N.Dialer {
|
||||
var dialer N.Dialer
|
||||
if options.Detour == "" {
|
||||
dialer = newDefault(options)
|
||||
} else {
|
||||
dialer = newDetour(router, options)
|
||||
}
|
||||
if options.OverrideOptions != nil {
|
||||
dialer = newOverride(dialer, common.PtrValueOrDefault(options.OverrideOptions))
|
||||
}
|
||||
return dialer
|
||||
}
|
||||
Reference in New Issue
Block a user