@@ -90,7 +90,7 @@ type server struct {
90
90
factory logging.Factory
91
91
// Listens for HTTP traffic on this address
92
92
listenHost string
93
- listenPort uint16
93
+ listenPort string
94
94
95
95
shutdownTimeout time.Duration
96
96
@@ -154,7 +154,7 @@ func New(
154
154
log : log ,
155
155
factory : factory ,
156
156
listenHost : host ,
157
- listenPort : port ,
157
+ listenPort : fmt . Sprintf ( "%d" , port ) ,
158
158
shutdownTimeout : shutdownTimeout ,
159
159
tracingEnabled : tracingEnabled ,
160
160
tracer : tracer ,
@@ -171,7 +171,7 @@ func New(
171
171
}
172
172
173
173
func (s * server ) Dispatch () error {
174
- listenAddress := fmt . Sprintf ( "%s:%d" , s .listenHost , s .listenPort )
174
+ listenAddress := net . JoinHostPort ( s .listenHost , s .listenPort )
175
175
listener , err := net .Listen ("tcp" , listenAddress )
176
176
if err != nil {
177
177
return err
@@ -193,7 +193,7 @@ func (s *server) Dispatch() error {
193
193
}
194
194
195
195
func (s * server ) DispatchTLS (certBytes , keyBytes []byte ) error {
196
- listenAddress := fmt . Sprintf ( "%s:%d" , s .listenHost , s .listenPort )
196
+ listenAddress := net . JoinHostPort ( s .listenHost , s .listenPort )
197
197
cert , err := tls .X509KeyPair (certBytes , keyBytes )
198
198
if err != nil {
199
199
return err
0 commit comments