give access to server

This commit is contained in:
bfu4 2021-11-18 21:07:07 -05:00
parent 4f30e9f812
commit df2ea7d310
No known key found for this signature in database
GPG Key ID: FD1D952871D22043

6
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 // ListenAndServe listens on the TCP network address addr and then calls Serve
// with handler to handle sessions on incoming connections. Handler is typically // with handler to handle sessions on incoming connections. Handler is typically
// nil, in which case the DefaultHandler is used. // 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} srv := &Server{Addr: addr, Handler: handler}
for _, option := range options { for _, option := range options {
if err := srv.SetOption(option); err != nil { 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. // Handle registers the handler as the DefaultHandler.