func (m *VhostMuxer) Listen(name string) (net.Listener, error) {
	name = normalize(name)
	vhost := &Listener{
		name:   name,
		mux:    m,
		accept: make(chan Conn),
	}
	if err := m.set(name, vhost); err != nil {
		return nil, err
	}
	return vhost, nil
}
Listen begins multiplexing the underlying connection to send new
connections for the given name over the returned listener.
package vhost
import (
	"fmt"
	"net"
	"strings"
	"sync"
	"time"
)
var (
	normalize = strings.ToLower
	isClosed  = func(err error) bool {
		netErr, ok := err.(net.Error)
		if ok {
			return netErr.Temporary()
		}
		return false
	}
)
type NotFound struct {
	error
}
type BadRequest struct {
	error
}
type Closed struct {
	error
}
type (
	muxFn func(net.Conn) (Conn, error)
	muxErr struct {
		err  error
		conn net.Conn
	}
)
type VhostMuxer struct {
	listener     net.Listener          
	muxTimeout   time.Duration         
	vhostFn      muxFn                 
	muxErrors    chan muxErr           
	registry     map[string]*Listener  
	sync.RWMutex                       
}
func NewVhostMuxer(listener net.Listener, vhostFn muxFn, muxTimeout time.Duration) (*VhostMuxer, error) {
	mux := &VhostMuxer{
		listener:   listener,
		muxTimeout: muxTimeout,
		vhostFn:    vhostFn,
		muxErrors:  make(chan muxErr),
		registry:   make(map[string]*Listener),
	}
	go mux.run()
	return mux, nil
}