구조체에 json tag 추가
This commit is contained in:
		
							parent
							
								
									ac4646131b
								
							
						
					
					
						commit
						e25164ad30
					
				@ -20,9 +20,11 @@ type ConnectionHandlers struct {
 | 
			
		||||
	// The maximum number of concurrent connections the server may serve.
 | 
			
		||||
	//
 | 
			
		||||
	// DefaultConcurrency is used if not set.
 | 
			
		||||
	Concurrency      int
 | 
			
		||||
	KeepAlive        time.Duration
 | 
			
		||||
	HandshakeTimeout time.Duration
 | 
			
		||||
	Network 		 string			`json:"network"`
 | 
			
		||||
	Address 		 string			`json:"address"`
 | 
			
		||||
	Concurrency      int			`json:"concurrency"`
 | 
			
		||||
	KeepAlive        time.Duration	`json:"keepAlive"`
 | 
			
		||||
	HandshakeTimeout time.Duration	`json:"handshakeTimeout"`
 | 
			
		||||
	TLSConfig        *tls.Config
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,7 @@ type ReadWriteHandler interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type ReadWriteHandlers struct {
 | 
			
		||||
	MaxMessageSize int64
 | 
			
		||||
	MaxMessageSize int64		`json:"maxMessageSize"`
 | 
			
		||||
	// Per-connection buffer size for requests' reading.
 | 
			
		||||
	// This also limits the maximum header size.
 | 
			
		||||
	//
 | 
			
		||||
@ -21,23 +21,23 @@ type ReadWriteHandlers struct {
 | 
			
		||||
	// and/or multi-KB headers (for example, BIG cookies).
 | 
			
		||||
	//
 | 
			
		||||
	// Default buffer size is used if not set.
 | 
			
		||||
	ReadBufferSize int
 | 
			
		||||
	ReadBufferSize int			`json:"readBufferSize"`
 | 
			
		||||
	// Per-connection buffer size for responses' writing.
 | 
			
		||||
	//
 | 
			
		||||
	// Default buffer size is used if not set.
 | 
			
		||||
	WriteBufferSize int
 | 
			
		||||
	WriteBufferSize int			`json:"writeBufferSize"`
 | 
			
		||||
	// 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
 | 
			
		||||
	ReadTimeout time.Duration	`json:"readTimeout"`
 | 
			
		||||
 | 
			
		||||
	// Maximum duration for writing the full response (including body).
 | 
			
		||||
	//
 | 
			
		||||
	// By default response write timeout is unlimited.
 | 
			
		||||
	WriteTimeout time.Duration
 | 
			
		||||
	WriteTimeout time.Duration	`json:"writeTimeout"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (rwh *ReadWriteHandlers) GetMaxMessageSize() int64 {
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,7 @@ type ServerHandlers struct {
 | 
			
		||||
	// Server name for sending in response headers.
 | 
			
		||||
	//
 | 
			
		||||
	// Default server name is used if left blank.
 | 
			
		||||
	Name string
 | 
			
		||||
	Name string			`json:"name"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (sh *ServerHandlers) ServerCtx() ServerCtx {
 | 
			
		||||
 | 
			
		||||
@ -16,8 +16,8 @@ type ClientConnHandler interface {
 | 
			
		||||
type ClientConnHandlers struct {
 | 
			
		||||
	server.ConnectionHandlers
 | 
			
		||||
 | 
			
		||||
	ReconnectInterval time.Duration
 | 
			
		||||
	ReconnectTryTime  int
 | 
			
		||||
	ReconnectInterval time.Duration	`json:"reconnectInterval"`
 | 
			
		||||
	ReconnectTryTime  int			`json:"reconnectTryTime"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (cch *ClientConnHandlers) GetReconnectInterval() time.Duration {
 | 
			
		||||
 | 
			
		||||
@ -15,10 +15,10 @@ type Client struct {
 | 
			
		||||
	socket.ClientConnHandlers
 | 
			
		||||
	socket.ReadWriteHandlers
 | 
			
		||||
 | 
			
		||||
	Name string
 | 
			
		||||
	Name string					`json:"name"`
 | 
			
		||||
 | 
			
		||||
	Network      string
 | 
			
		||||
	Address      string
 | 
			
		||||
	Network      string			`json:"network"`
 | 
			
		||||
	Address      string			`json:"address"`
 | 
			
		||||
	LocalAddress net.Addr
 | 
			
		||||
 | 
			
		||||
	stopChan chan struct{}
 | 
			
		||||
 | 
			
		||||
@ -18,11 +18,11 @@ type ReadWriteHandler interface {
 | 
			
		||||
type ReadWriteHandlers struct {
 | 
			
		||||
	server.ReadWriteHandlers
 | 
			
		||||
 | 
			
		||||
	PongTimeout time.Duration
 | 
			
		||||
	PingTimeout time.Duration
 | 
			
		||||
	PingPeriod  time.Duration
 | 
			
		||||
	PongTimeout time.Duration	`json:"pongTimeout"`
 | 
			
		||||
	PingTimeout time.Duration	`json:"pingTimeout"`
 | 
			
		||||
	PingPeriod  time.Duration	`json:"pingPeriod"`
 | 
			
		||||
 | 
			
		||||
	EnableCompression bool
 | 
			
		||||
	EnableCompression bool		`json:"enableCompression"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (rwh *ReadWriteHandlers) GetPongTimeout() time.Duration {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user