type Server struct { Addr string//TCP address to listen on Handler Handler //handler to invoke ReadTimeout time.Duration //maximum duration before timing out read of the request WriteTimeout time.Duration //maximum duration before timing out write of the response TLSConfig *tls.Config ... } //Handler是一个interface,定义如下 type Handler interface { ServeHTTP(ResponseWrite, *Request) }
type Server struct { Addr string//TCP address to listen on Handler Handler //handler to invoke ReadTimeout time.Duration //maximum duration before timing out read of the request WriteTimeout time.Duration //maximum duration before timing out write of the response TLSConfig *tls.Config ... } //Handler是一个interface,定义如下 type Handler interface { ServeHTTP(ResponseWrite, *Request) }