mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
safeweb: add a ListenAndServe method to the Server type (#13498)
Updates #13497 Change-Id: I398e9fa58ad0b9dc799ea280c9c7a32150150ee4 Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
This commit is contained in:
parent
951884b077
commit
5f89c93274
@ -301,6 +301,19 @@ func (s *Server) Serve(ln net.Listener) error {
|
||||
return s.h.Serve(ln)
|
||||
}
|
||||
|
||||
// ListenAndServe listens on the TCP network address addr and then calls Serve
|
||||
// to handle requests on incoming connections. If addr == "", ":http" is used.
|
||||
func (s *Server) ListenAndServe(addr string) error {
|
||||
if addr == "" {
|
||||
addr = ":http"
|
||||
}
|
||||
lst, err := net.Listen("tcp", addr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return s.Serve(lst)
|
||||
}
|
||||
|
||||
// Close closes all client connections and stops accepting new ones.
|
||||
func (s *Server) Close() error {
|
||||
return s.h.Close()
|
||||
|
Loading…
Reference in New Issue
Block a user