From df2ea7d3108a796c2d1ca6a98a0fb4d43e027c2d Mon Sep 17 00:00:00 2001 From: bfu4 Date: Thu, 18 Nov 2021 21:07:07 -0500 Subject: [PATCH] give access to server --- ssh.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ssh.go b/ssh.go index a659ba5..2d7ac00 100644 --- a/ssh.go +++ b/ssh.go @@ -98,14 +98,14 @@ func Serve(l net.Listener, handler Handler, options ...Option) (*Server, error) // ListenAndServe listens on the TCP network address addr and then calls Serve // with handler to handle sessions on incoming connections. Handler is typically // nil, in which case the DefaultHandler is used. -func ListenAndServe(addr string, handler Handler, options ...Option) error { +func ListenAndServe(addr string, handler Handler, options ...Option) (*Server, error) { srv := &Server{Addr: addr, Handler: handler} for _, option := range options { if err := srv.SetOption(option); err != nil { - return err + return nil, err } } - return srv.ListenAndServe() + return srv, srv.ListenAndServe() } // Handle registers the handler as the DefaultHandler.