|
@@ -88,6 +88,14 @@ func withPort(host string) string {
|
|
|
return host
|
|
return host
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// withoutPort strips the port from addr if present.
|
|
|
|
|
+func withoutPort(addr string) string {
|
|
|
|
|
+ if h, _, err := net.SplitHostPort(addr); err == nil {
|
|
|
|
|
+ return h
|
|
|
|
|
+ }
|
|
|
|
|
+ return addr
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// h2i is the app's state.
|
|
// h2i is the app's state.
|
|
|
type h2i struct {
|
|
type h2i struct {
|
|
|
host string
|
|
host string
|
|
@@ -134,7 +142,7 @@ func main() {
|
|
|
|
|
|
|
|
func (app *h2i) Main() error {
|
|
func (app *h2i) Main() error {
|
|
|
cfg := &tls.Config{
|
|
cfg := &tls.Config{
|
|
|
- ServerName: app.host,
|
|
|
|
|
|
|
+ ServerName: withoutPort(app.host),
|
|
|
NextProtos: strings.Split(*flagNextProto, ","),
|
|
NextProtos: strings.Split(*flagNextProto, ","),
|
|
|
InsecureSkipVerify: *flagInsecure,
|
|
InsecureSkipVerify: *flagInsecure,
|
|
|
}
|
|
}
|