Add protect path dialer option

This commit is contained in:
世界
2022-07-06 14:45:56 +08:00
parent dcd7ca78fc
commit 46f28a9de9
4 changed files with 61 additions and 0 deletions

View File

@@ -32,6 +32,10 @@ func newDefault(options option.DialerOptions) N.Dialer {
if options.ReuseAddr {
listener.Control = control.Append(listener.Control, control.ReuseAddr())
}
if options.ProtectPath != "" {
dialer.Control = control.Append(dialer.Control, ProtectPath(options.ProtectPath))
listener.Control = control.Append(listener.Control, ProtectPath(options.ProtectPath))
}
if options.ConnectTimeout != 0 {
dialer.Timeout = time.Duration(options.ConnectTimeout) * time.Second
}