1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-05 09:47:56 -05:00
v2fly/transport/internet/domainsocket/dial.go

20 lines
360 B
Go
Raw Normal View History

2017-11-03 08:02:05 -04:00
package domainsocket
2017-11-22 08:53:22 -05:00
import (
"context"
"net"
)
2017-11-03 08:02:05 -04:00
2017-11-22 08:53:22 -05:00
func DialDS(ctx context.Context, path string) (*net.UnixConn, error) {
resolvedAddress, err := net.ResolveUnixAddr("unixpacket", path)
if err != nil {
return nil, err
}
dialedUnix, err := net.DialUnix("unixpacket", nil, resolvedAddress)
if err != nil {
return nil, err
}
return dialedUnix, nil
2017-11-03 08:02:05 -04:00
}