This commit is contained in:
crusader 2018-04-14 17:49:33 +09:00
parent 530a422ab7
commit 750524f29c
8 changed files with 22 additions and 22 deletions

View File

@ -13,7 +13,7 @@ type Connector interface {
}
type Connectors struct {
Name string `json:"name"`
Name string `json:"name,omitempty"`
validated atomic.Value
}

View File

@ -20,11 +20,11 @@ type ConnectionHandlers struct {
// The maximum number of concurrent connections the server may serve.
//
// DefaultConcurrency is used if not set.
Network string `json:"network"`
Address string `json:"address"`
Concurrency int `json:"concurrency"`
KeepAlive time.Duration `json:"keepAlive"`
HandshakeTimeout time.Duration `json:"handshakeTimeout"`
Network string `json:"network,omitempty"`
Address string `json:"address,omitempty"`
Concurrency int `json:"concurrency,omitempty"`
KeepAlive time.Duration `json:"keepAlive,omitempty"`
HandshakeTimeout time.Duration `json:"handshakeTimeout,omitempty"`
TLSConfig *tls.Config `json:"-"`
validated atomic.Value
}

View File

@ -14,7 +14,7 @@ type ReadWriteHandler interface {
}
type ReadWriteHandlers struct {
MaxMessageSize int64 `json:"maxMessageSize"`
MaxMessageSize int64 `json:"maxMessageSize,omitempty"`
// Per-connection buffer size for requests' reading.
// This also limits the maximum header size.
//
@ -22,23 +22,23 @@ type ReadWriteHandlers struct {
// and/or multi-KB headers (for example, BIG cookies).
//
// Default buffer size is used if not set.
ReadBufferSize int `json:"readBufferSize"`
ReadBufferSize int `json:"readBufferSize,omitempty"`
// Per-connection buffer size for responses' writing.
//
// Default buffer size is used if not set.
WriteBufferSize int `json:"writeBufferSize"`
WriteBufferSize int `json:"writeBufferSize,omitempty"`
// Maximum duration for reading the full request (including body).
//
// This also limits the maximum duration for idle keep-alive
// connections.
//
// By default request read timeout is unlimited.
ReadTimeout time.Duration `json:"readTimeout"`
ReadTimeout time.Duration `json:"readTimeout,omitempty"`
// Maximum duration for writing the full response (including body).
//
// By default response write timeout is unlimited.
WriteTimeout time.Duration `json:"writeTimeout"`
WriteTimeout time.Duration `json:"writeTimeout,omitempty"`
validated atomic.Value
}

View File

@ -22,7 +22,7 @@ type ServerHandlers struct {
// Server name for sending in response headers.
//
// Default server name is used if left blank.
Name string `json:"name"`
Name string `json:"name,omitempty"`
validated atomic.Value
}

View File

@ -17,8 +17,8 @@ type ClientConnHandler interface {
type ClientConnHandlers struct {
server.ConnectionHandlers
ReconnectInterval time.Duration `json:"reconnectInterval"`
ReconnectTryTime int `json:"reconnectTryTime"`
ReconnectInterval time.Duration `json:"reconnectInterval,omitempty"`
ReconnectTryTime int `json:"reconnectTryTime,omitempty"`
validated atomic.Value
}

View File

@ -18,8 +18,8 @@ type Connectors struct {
socket.ClientConnHandlers
socket.ReadWriteHandlers
Network string `json:"network"`
Address string `json:"address"`
Network string `json:"network,omitempty"`
Address string `json:"address,omitempty"`
LocalAddress net.Addr `json:"-"`
stopChan chan struct{}

View File

@ -19,11 +19,11 @@ type ReadWriteHandler interface {
type ReadWriteHandlers struct {
server.ReadWriteHandlers
PongTimeout time.Duration `json:"pongTimeout"`
PingTimeout time.Duration `json:"pingTimeout"`
PingPeriod time.Duration `json:"pingPeriod"`
PongTimeout time.Duration `json:"pongTimeout,omitempty"`
PingTimeout time.Duration `json:"pingTimeout,omitempty"`
PingPeriod time.Duration `json:"pingPeriod,omitempty"`
EnableCompression bool `json:"enableCompression"`
EnableCompression bool `json:"enableCompression,omitempty"`
validated atomic.Value
}

View File

@ -30,11 +30,11 @@ type Connectors struct {
socket.ClientConnHandlers
socket.ReadWriteHandlers
URL string `json:"url"`
URL string `json:"url,omitempty"`
RequestHeader func() http.Header `json:"-"`
Subprotocols []string `json:"subprotocols"`
Subprotocols []string `json:"subprotocols,omitempty"`
// Jar specifies the cookie jar.
// If Jar is nil, cookies are not sent in requests and ignored
// in responses.