mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-04 20:37:40 +03:00
22 lines
488 B
Go
22 lines
488 B
Go
package network
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
|
|
M "github.com/sagernet/sing/common/metadata"
|
|
)
|
|
|
|
type ContextDialer interface {
|
|
DialContext(ctx context.Context, network string, address *M.AddrPort) (net.Conn, error)
|
|
}
|
|
|
|
var SystemDialer ContextDialer = &DefaultDialer{}
|
|
|
|
type DefaultDialer struct {
|
|
net.Dialer
|
|
}
|
|
|
|
func (d *DefaultDialer) DialContext(ctx context.Context, network string, address *M.AddrPort) (net.Conn, error) {
|
|
return d.Dialer.DialContext(ctx, network, address.String())
|
|
}
|