Commit b2fe5727 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 496bd425
......@@ -47,6 +47,7 @@ type Networker interface {
// NetPlain creates Networker corresponding to regular network accessors from std package net.
//
// network is "tcp", "tcp4", "tcp6", "unix", etc...
func NetPlain(network string) Networker {
return netPlain(network)
......@@ -68,6 +69,7 @@ func (n netPlain) Listen(laddr string) (net.Listener, error) {
}
// NetTLS wraps underlying networker with TLS layer according to config.
//
// The config must be valid:
// - for tls.Client -- for Dial to work,
// - for tls.Server -- for Listen to work.
......
......@@ -131,6 +131,7 @@ type dialReq struct {
//trace:event traceNew(name string)
// New creates new pipenet Network
//
// name is name of this network under "pipe" namespace, e.g. "α" will give full network name "pipeα".
//
// New does not check whether network name provided is unique.
......@@ -143,7 +144,8 @@ func New(name string) *Network {
//trace:event traceNewHost(host *Host)
// Host returns network access point by name
// if there was no such host before it creates new one
//
// If there was no such host before it creates new one.
func (n *Network) Host(name string) *Host {
n.mu.Lock()
defer n.mu.Unlock()
......@@ -183,6 +185,7 @@ func (h *Host) resolveAddr(addr string) (host *Host, port int, err error) {
//trace:event traceListen(laddr string)
// Listen starts new listener
//
// It either allocates free port if laddr is "" or with 0 port, or binds to laddr.
// Once listener is started, Dials could connect to listening address.
// Connection requests created by Dials could be accepted via Accept.
......@@ -300,6 +303,7 @@ func (l *listener) Accept() (net.Conn, error) {
//trace:event traceDial(addr string)
// Dial dials address on the network
//
// It tries to connect to Accept called on listener corresponding to addr.
func (h *Host) Dial(ctx context.Context, addr string) (net.Conn, error) {
traceDial(addr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment