func (p *PluginBroker) SendResult(exchange *HTTPExchange) error {
	for _, plugin := range p.plugins {
		if plugin.Input != nil {
			req, err := exchange.Request.CloneBody(context.Background())
			if err != nil {
				return err
			}
			resp, err := exchange.Response.CloneBody()
			if err != nil {
				return err
			}
			plugin.Input <- &HTTPExchange{
				Request:  req,
				Response: resp,
				Target:   exchange.Target,
			}
		}
	}
	return nil
}
SendResult sends a *Result to all loaded plugins for further processing.
package judas
import (
	"context"
	"log"
	"net/http"
	"net/url"
	"plugin"
	"strings"
)
type InitializerFunc func(*log.Logger) (Listener, error)
type Listener interface {
	Listen(<-chan *HTTPExchange)
}
type HTTPExchange struct {
	Request  *Request
	Response *Response
	Target   *url.URL
}
type RequestTransformer func(*http.Request) error
type ResponseTransformer func(*http.Response) error
type PluginBroker struct {
	plugins []*pluginInfo
	logger  *log.Logger
}
func (p *PluginBroker) TransformRequest(request *http.Request) error {
	for _, plugin := range p.plugins {
		if plugin.RequestTransformer != nil {
			err := plugin.RequestTransformer(request)
			if err != nil {
				return err
			}
		}
	}
	return nil
}
func (p *PluginBroker) TransformResponse(response *http.Response) error {
	for _, plugin := range p.plugins {
		if plugin.ResponseTransformer != nil {
			err := plugin.ResponseTransformer(response)
			if err != nil {
				return err
			}
		}
	}
	return nil
}