Sockopt: Cancel dialing after failed to bind interface, external controllers included such as TUN inbound's (#7173)

https://github.com/XTLS/Xray-core/pull/7161#issuecomment-6185101741

Fixes https://github.com/XTLS/Xray-core/issues/7160#issuecomment-6200788453

---------

Co-authored-by: Gleb <a1212gleb@gmail.com>
This commit is contained in:
风扇滑翔翼
2026-10-16 06:37:52 +00:00
committed by GitHub
co-authored by Gleb
parent d15966c76c
commit fe2ae23f42
6 changed files with 66 additions and 28 deletions
+19
View File
@@ -28,3 +28,22 @@ func (v *SocketConfig) ParseTFOValue() int {
}
return tfo
}
// Dial should fail on bind errors, return this to indicate such errors.
type BindError struct {
err error
}
func (e *BindError) Unwrap() error {
return e.err
}
func (e *BindError) Error() string {
return "failed to bind to interface: " + e.err.Error()
}
func NewBindError(err error) *BindError {
return &BindError{
err: err,
}
}