mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-29 12:01:29 +00:00
22 lines
532 B
Go
22 lines
532 B
Go
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.IsValid() {
|
|
dialer = newOverride(dialer, common.PtrValueOrDefault(options.OverrideOptions))
|
|
}
|
|
return dialer
|
|
}
|