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