Commit b2fe5727 authored by Kirill Smelkov's avatar Kirill Smelkov

.

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