give access to server
This commit is contained in:
parent
4f30e9f812
commit
df2ea7d310
6
ssh.go
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.
|
||||||
|
Loading…
Reference in New Issue
Block a user