api/plugins/http_proxy/init.go
Peter Kurfer 671958e123
Complete first naive HTTP proxy implementation
- HTTPS configuration is till missing
- fix a few minor things in other plugins
- cleanup of config to reduce repeating of the same values multiple times
2020-04-12 03:51:41 +02:00

23 lines
482 B
Go

package main
import (
"github.com/baez90/inetmock/internal/plugins"
"github.com/baez90/inetmock/pkg/api"
"github.com/baez90/inetmock/pkg/logging"
"go.uber.org/zap"
"gopkg.in/elazarl/goproxy.v1"
)
func init() {
logger, _ := logging.CreateLogger()
logger = logger.With(
zap.String("ProtocolHandler", name),
)
plugins.Registry().RegisterHandler(name, func() api.ProtocolHandler {
return &httpProxy{
logger: logger,
proxy: goproxy.NewProxyHttpServer(),
}
})
}