2022-01-10 17:11:30 +00:00
|
|
|
package net
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Listen(network, address string) (Listener, error) {
|
|
|
|
l, err := net.Listen(network, address)
|
|
|
|
if err != nil {
|
|
|
|
return Listener{}, err
|
|
|
|
}
|
|
|
|
|
2022-01-11 17:15:45 +00:00
|
|
|
return Listener{listener: l}, nil
|
2022-01-10 17:11:30 +00:00
|
|
|
}
|
|
|
|
|
2022-01-13 16:06:14 +00:00
|
|
|
func Dial(network, address string) (*Conn, error) {
|
2022-01-10 17:11:30 +00:00
|
|
|
conn, err := net.Dial(network, address)
|
|
|
|
if err != nil {
|
2022-01-13 16:06:14 +00:00
|
|
|
return &Conn{}, err
|
2022-01-10 17:11:30 +00:00
|
|
|
}
|
|
|
|
|
2022-01-13 16:06:14 +00:00
|
|
|
return &Conn{conn: conn}, nil
|
2022-01-10 17:11:30 +00:00
|
|
|
}
|