Don't stringify the remote addr on each request.
diff --git a/server.go b/server.go
index 9cdfb4a..aba029a 100644
--- a/server.go
+++ b/server.go
@@ -188,6 +188,7 @@
srv: srv,
hs: hs,
conn: c,
+ remoteAddrStr: c.RemoteAddr().String(),
bw: newBufferedWriter(c),
handler: h,
streams: make(map[uint32]*stream),
@@ -321,6 +322,7 @@
flow flow // conn-wide (not stream-specific) outbound flow control
inflow flow // conn-wide inbound flow control
tlsState *tls.ConnectionState // shared by all handlers, like net/http
+ remoteAddrStr string
// Everything following is owned by the serve loop; use serveG.check():
serveG goroutineLock // used to verify funcs are on serve()
@@ -1350,7 +1352,7 @@
req := &http.Request{
Method: rp.method,
URL: url,
- RemoteAddr: sc.conn.RemoteAddr().String(),
+ RemoteAddr: sc.remoteAddrStr,
Header: rp.header,
RequestURI: rp.path,
Proto: "HTTP/2.0",