2020-06-15 10:04:08 +00:00
|
|
|
package tls_interceptor
|
2020-04-01 02:08:21 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/baez90/inetmock/pkg/api"
|
|
|
|
"github.com/baez90/inetmock/pkg/logging"
|
2020-04-25 23:18:35 +00:00
|
|
|
"github.com/google/uuid"
|
2020-04-01 02:08:21 +00:00
|
|
|
"go.uber.org/zap"
|
|
|
|
"sync"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
logger, _ := logging.CreateLogger()
|
|
|
|
logger = logger.With(
|
|
|
|
zap.String("ProtocolHandler", name),
|
|
|
|
)
|
|
|
|
|
2020-06-15 10:04:08 +00:00
|
|
|
api.Registry().RegisterHandler(name, func() api.ProtocolHandler {
|
2020-04-01 02:08:21 +00:00
|
|
|
return &tlsInterceptor{
|
|
|
|
logger: logger,
|
|
|
|
currentConnectionsCount: &sync.WaitGroup{},
|
2020-04-25 23:18:35 +00:00
|
|
|
currentConnections: make(map[uuid.UUID]*proxyConn),
|
2020-04-01 02:08:21 +00:00
|
|
|
}
|
2020-04-25 22:22:45 +00:00
|
|
|
})
|
2020-04-01 02:08:21 +00:00
|
|
|
}
|