Documentation
¶
Overview ¶
The rtplugs package instruments golang http clients that supports a RoundTripper interface. It was built and tested against https://pkg.go.dev/net/http/httputil#ReverseProxy
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RoundTrip ¶
type RoundTrip struct {
// contains filtered or unexported fields
}
An http.RoundTripper interface to be used as Transport for http clients
To extend reverseproxy use:
rt := rtplugs.New(log) if rt != nil { defer rt.Close() reverseproxy.Transport = rt.Transport(reverseproxy.Transport) }
While `log` is an optional logger
func New ¶
New(pi.Logger) will attempt to strat a list of plugs
env RTPLUGS defines a comma seperated list of plug names A typical RTPLUGS value would be "rtplug,wsplug" The plugs may be added statically (using imports) or dynmaicaly (.so files)
func NewConfigrablePlugs ¶ added in v1.3.11
func NewConfigrablePlugs(ctxin context.Context, logger pi.Logger, svcname string, namespace string, plugs []string, c map[string]map[string]string) (ctxout context.Context, rt *RoundTrip)
Context() wraps an existing RoundTripper
Once the existing RoundTripper is wrapped, data flowing to and from the existing RoundTripper will be screened using the security plugs
func (*RoundTrip) Close ¶
func (rt *RoundTrip) Close()
Close() gracefully shuts down all plugs
Note that Close does not unload the .so files, instead, it informs all loaded plugs to gracefully shutdown and cleanup
func (*RoundTrip) Transport ¶
func (rt *RoundTrip) Transport(t http.RoundTripper) http.RoundTripper
Transport() wraps an existing RoundTripper
Once the existing RoundTripper is wrapped, data flowing to and from the existing RoundTripper will be screened using the security plugs