1 parent
1fb960575f
commit
beb97ac9f2
9 files changed
+70
-36
No files matched your search
@@ -1,6 +1,8 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
serverpb "github.com/hashicorp/boundary/internal/gen/controller/servers/services"
|
||||
)
|
||||
|
||||
@@ -19,11 +21,13 @@ func GetOpts(opt ...Option) Options {
|
||||
// Options = how options are represented
|
||||
type Options struct {
|
||||
WithInjectedApplicationCredentials []*serverpb.Credential
|
||||
WithPostConnectionHook func(net.Conn)
|
||||
}
|
||||
|
||||
func getDefaultOptions() Options {
|
||||
return Options{
|
||||
WithInjectedApplicationCredentials: nil,
|
||||
WithPostConnectionHook: nil,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,3 +38,13 @@ func WithInjectedApplicationCredentials(creds []*serverpb.Credential) Option {
|
||||
o.WithInjectedApplicationCredentials = creds
|
||||
}
|
||||
}
|
||||
|
||||
// WithPostConnectionHook provides a hook function to be called after a
|
||||
// connection is established in a dialFunction. When a dialer accepts
|
||||
// WithPostConnectionHook the passed in function should be called prior to any
|
||||
// other blocking call.
|
||||
func WithPostConnectionHook(fn func(net.Conn)) Option {
|
||||
return func(o *Options) {
|
||||
o.WithPostConnectionHook = fn
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user