-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use callback to create net.Listener (#1)
Co-authored-by: Dean Sheather <[email protected]>
- Loading branch information
1 parent
9e6b773
commit f86b780
Showing
3 changed files
with
44 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package ssh | |
|
||
import ( | ||
"crypto/subtle" | ||
"errors" | ||
"net" | ||
|
||
gossh "golang.org/x/crypto/ssh" | ||
|
@@ -29,6 +30,9 @@ const ( | |
// DefaultHandler is the default Handler used by Serve. | ||
var DefaultHandler Handler | ||
|
||
// ErrReject is returned by some callbacks to reject a request. | ||
var ErrRejected = errors.New("rejected") | ||
|
||
// Option is a functional option handler for Server. | ||
type Option func(*Server) error | ||
|
||
|
@@ -69,8 +73,9 @@ type ReversePortForwardingCallback func(ctx Context, bindHost string, bindPort u | |
type LocalUnixForwardingCallback func(ctx Context, socketPath string) bool | ||
|
||
// ReverseUnixForwardingCallback is a hook for allowing reverse unix forwarding | ||
// ([email protected]). | ||
type ReverseUnixForwardingCallback func(ctx Context, socketPath string) bool | ||
// ([email protected]). Returning ErrRejected will reject the | ||
// request. | ||
type ReverseUnixForwardingCallback func(ctx Context, socketPath string) (net.Listener, error) | ||
|
||
// ServerConfigCallback is a hook for creating custom default server configs | ||
type ServerConfigCallback func(ctx Context) *gossh.ServerConfig | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters