Multiplex http and ssh ports

This commit is contained in:
Tom Wiesing 2023-03-08 11:27:19 +01:00
parent 668f1dd193
commit f0073a649f
No known key found for this signature in database
20 changed files with 188 additions and 29 deletions

View file

@ -23,6 +23,14 @@ type HTTPConfig struct {
CertbotEmail string `yaml:"certbot_email" validate:"email"`
}
// TCPMuxCommand generates a command line for the sslh executable.
func (hcfg HTTPConfig) TCPMuxCommand(addr string, http string, https string, ssh string) string {
if hcfg.HTTPSEnabled() {
return fmt.Sprintf("-bind %s -http %s -tls %s -rest %s", addr, http, https, ssh)
}
return fmt.Sprintf("-bind %s -http %s -rest %s", addr, http, ssh)
}
// HTTPSEnabled returns if the distillery has HTTPS enabled, and false otherwise.
func (hcfg HTTPConfig) HTTPSEnabled() bool {
return hcfg.CertbotEmail != ""