api/plugins/tls_interceptor/protocol_options.go
Peter Kurfer 108444e094 Add health API and basic CLI support
- remove plugin API due to incompatibility issues
- add Docker build to GitHub Actions
- add custom container friendly config file
2020-06-15 12:32:18 +02:00

33 lines
648 B
Go

package tls_interceptor
import (
"fmt"
"github.com/spf13/viper"
)
const (
targetIpAddressConfigKey = "target.ipAddress"
targetPortConfigKey = "target.port"
)
type redirectionTarget struct {
ipAddress string
port uint16
}
func (rt redirectionTarget) address() string {
return fmt.Sprintf("%s:%d", rt.ipAddress, rt.port)
}
type tlsOptions struct {
redirectionTarget redirectionTarget
}
func loadFromConfig(config *viper.Viper) tlsOptions {
return tlsOptions{
redirectionTarget: redirectionTarget{
ipAddress: config.GetString(targetIpAddressConfigKey),
port: uint16(config.GetInt(targetPortConfigKey)),
},
}
}