mirror of
https://github.com/tinygo-org/net.git
synced 2026-07-26 08:18:39 +00:00
net: add ResolveUnixAddr
Signed-off-by: Christian Stewart <christian@aperture.us>
This commit is contained in:
committed by
Ron Evans
parent
a79417481d
commit
d9132d2a52
+17
@@ -12,6 +12,8 @@ package net
|
||||
// BUG(mikio): On Windows, methods and functions related to UnixConn
|
||||
// and UnixListener don't work for "unixgram" and "unixpacket".
|
||||
|
||||
// BUG(paralin): On TinyGo, Unix sockets are not implemented.
|
||||
|
||||
// UnixAddr represents the address of a Unix domain socket end point.
|
||||
type UnixAddr struct {
|
||||
Name string
|
||||
@@ -41,3 +43,18 @@ func (a *UnixAddr) opAddr() Addr {
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
// ResolveUnixAddr returns an address of Unix domain socket end point.
|
||||
//
|
||||
// The network must be a Unix network name.
|
||||
//
|
||||
// See func [Dial] for a description of the network and address
|
||||
// parameters.
|
||||
func ResolveUnixAddr(network, address string) (*UnixAddr, error) {
|
||||
switch network {
|
||||
case "unix", "unixgram", "unixpacket":
|
||||
return &UnixAddr{Name: address, Net: network}, nil
|
||||
default:
|
||||
return nil, UnknownNetworkError(network)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user