func (ll *LoopbackListener) Addr() (addr net.Addr) {
	return LoopbackAddr{}
}
Addr returns the listener's network address.
package libkb
import (
	"bytes"
	"io"
	"net"
	"sync"
	"syscall"
	"time"
)
type LoopbackAddr struct{}
type LoopbackListener struct {
	mutex    sync.Mutex
	ch       chan *LoopbackConn
	isClosed bool
}
type LoopbackConn struct {
	wMutex   sync.Mutex
	isClosed bool
	ch       chan<- []byte
	rMutex    sync.Mutex
	partnerCh <-chan []byte
	buf       bytes.Buffer
}
func NewLoopbackListener() *LoopbackListener {
	return &LoopbackListener{
		ch:       make(chan *LoopbackConn),
		isClosed: false,
	}
}
func NewLoopbackConnPair() (*LoopbackConn, *LoopbackConn) {
	aCh := make(chan []byte)
	bCh := make(chan []byte)
	a := &LoopbackConn{ch: aCh}
	b := &LoopbackConn{ch: bCh}
	a.partnerCh = bCh
	b.partnerCh = aCh
	return a, b
}
func (ll *LoopbackListener) Dial() (net.Conn, error) {
	G.Log.Debug("+ LoopbackListener.Dial")
	ll.mutex.Lock()
	defer ll.mutex.Unlock()
	if ll.isClosed {
		return nil, syscall.EINVAL
	}
	a, b := NewLoopbackConnPair()
	ll.ch <- a
	return b, nil
}
func (ll *LoopbackListener) Accept() (ret net.Conn, err error) {
	G.Log.Debug("+ LoopbackListener.Accept")
	var ok bool
	if ret, ok = <-ll.ch; !ok {
		err = syscall.EINVAL
	}
	G.Log.Debug("- LoopbackListener.Accept -> %v", err)
	return ret, err
}
func (ll *LoopbackListener) Close() (err error) {
	ll.mutex.Lock()
	defer ll.mutex.Unlock()
	if ll.isClosed {
		return syscall.EINVAL
	}
	ll.isClosed = true
	close(ll.ch)
	return
}