Commit 65ab3d34 authored by Kirill Smelkov's avatar Kirill Smelkov

xnet: Polish documentation a bit

- clarify Networker.Name on example of NetPlain;
- we don't need Networker.Addr since we have Networker.Name;
- format Dial/Listen docstrings so that they render properly under godoc;
- format list in NetTLS doc so that it renders properly under godoc.
parent c311277e
...@@ -29,22 +29,25 @@ import ( ...@@ -29,22 +29,25 @@ import (
"crypto/tls" "crypto/tls"
) )
// Networker is interface representing access-point to a streaming network // Networker is interface representing access-point to a streaming network.
type Networker interface { type Networker interface {
// Network returns name of the network // Network returns name of the network
Network() string Network() string
// Name returns name of the access-point on the network // Name returns name of the access-point on the network.
//
// Example of name is local hostname if networker provides access to
// OS-level dial/listen.
Name() string Name() string
// XXX +Addr() net.Addr -> address of this access-point on underlying network ? // Dial connects to addr on underlying network.
//
// Dial connects to addr on underlying network // See net.Dial for semantic details.
// see net.Dial for semantic details
Dial(ctx context.Context, addr string) (net.Conn, error) Dial(ctx context.Context, addr string) (net.Conn, error)
// Listen starts listening on local address laddr on underlying network access-point // Listen starts listening on local address laddr on underlying network access-point.
// see net.Listen for semantic details //
// See net.Listen for semantic details.
// //
// XXX also introduce xnet.Listener in which Accept() accepts also ctx? // XXX also introduce xnet.Listener in which Accept() accepts also ctx?
Listen(laddr string) (net.Listener, error) Listen(laddr string) (net.Listener, error)
...@@ -91,6 +94,7 @@ func (n *netPlain) Listen(laddr string) (net.Listener, error) { ...@@ -91,6 +94,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.
func NetTLS(inner Networker, config *tls.Config) Networker { func NetTLS(inner Networker, config *tls.Config) Networker {
......
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