mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 17:38:41 +00:00
Add DestIpAddress() in Dialer interface
Android client prepares an IP before proxy connection is established. It is useful when connecting to wireguard (or quic) outbound with domain address. E.g. engage.cloudflareclient.com:2408
This commit is contained in:
parent
5a5e615b46
commit
d60281d0a5
4 changed files with 91 additions and 3 deletions
|
@ -16,6 +16,7 @@ var effectiveSystemDialer SystemDialer = &DefaultSystemDialer{}
|
|||
|
||||
type SystemDialer interface {
|
||||
Dial(ctx context.Context, source net.Address, destination net.Destination, sockopt *SocketConfig) (net.Conn, error)
|
||||
DestIpAddress() net.IP
|
||||
}
|
||||
|
||||
type DefaultSystemDialer struct {
|
||||
|
@ -108,6 +109,10 @@ func (d *DefaultSystemDialer) Dial(ctx context.Context, src net.Address, dest ne
|
|||
return dialer.DialContext(ctx, dest.Network.SystemString(), dest.NetAddr())
|
||||
}
|
||||
|
||||
func (d *DefaultSystemDialer) DestIpAddress() net.IP {
|
||||
return nil
|
||||
}
|
||||
|
||||
type PacketConnWrapper struct {
|
||||
Conn net.PacketConn
|
||||
Dest net.Addr
|
||||
|
@ -172,6 +177,10 @@ func (v *SimpleSystemDialer) Dial(ctx context.Context, src net.Address, dest net
|
|||
return v.adapter.Dial(dest.Network.SystemString(), dest.NetAddr())
|
||||
}
|
||||
|
||||
func (d *SimpleSystemDialer) DestIpAddress() net.IP {
|
||||
return nil
|
||||
}
|
||||
|
||||
// UseAlternativeSystemDialer replaces the current system dialer with a given one.
|
||||
// Caller must ensure there is no race condition.
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue