code: func NewListener(s *stack.Stack, addr tcpip.FullAddress, network tcpip.NetworkProtocolNumber) (*Listener, error) {
  	// Create TCP endpoint, bind it, then start listening.
  	var wq waiter.Queue
  	ep, err := s.NewEndpoint(tcp.ProtocolNumber, network, &wq)
  	if err != nil {
  		return nil, errors.New(err.String())
  	}
  
  	if err := ep.Bind(addr); err != nil {
  		ep.Close()
  		return nil, &net.OpError{
  			Op:   "bind",
  			Net:  "tcp",
  			Addr: fullToTCPAddr(addr),
  			Err:  errors.New(err.String()),
  		}
  	}
  
  	if err := ep.Listen(10); err != nil {
  		ep.Close()
  		return nil, &net.OpError{
  			Op:   "listen",
  			Net:  "tcp",
  			Addr: fullToTCPAddr(addr),
  			Err:  errors.New(err.String()),
  		}
  	}
  
  	return &Listener{
  		stack:  s,
  		ep:     ep,
  		wq:     &wq,
  		cancel: make(chan struct{}),
  	}, nil
  }
docs: // NewListener creates a new Listener.