From 5794a9770841422318a85aa5e474b0a8d8afaf25 Mon Sep 17 00:00:00 2001 From: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com> Date: Thu, 19 Aug 2021 21:16:54 +0800 Subject: [PATCH] Fix: JSON tag case (#1212) JSON unmarshal is case insensitive in Golang --- infra/conf/transport_internet.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/infra/conf/transport_internet.go b/infra/conf/transport_internet.go index 240050fc1..07bd33a51 100644 --- a/infra/conf/transport_internet.go +++ b/infra/conf/transport_internet.go @@ -139,7 +139,6 @@ func (c *TCPConfig) Build() (proto.Message, error) { type WebSocketConfig struct { Path string `json:"path"` - Path2 string `json:"Path"` // The key was misspelled. For backward compatibility, we have to keep track the old key. Headers map[string]string `json:"headers"` AcceptProxyProtocol bool `json:"acceptProxyProtocol"` MaxEarlyData int32 `json:"maxEarlyData"` @@ -150,9 +149,6 @@ type WebSocketConfig struct { // Build implements Buildable. func (c *WebSocketConfig) Build() (proto.Message, error) { path := c.Path - if path == "" && c.Path2 != "" { - path = c.Path2 - } header := make([]*websocket.Header, 0, 32) for key, value := range c.Headers { header = append(header, &websocket.Header{ @@ -385,12 +381,11 @@ func (p TransportProtocol) Build() (string, error) { } type SocketConfig struct { - Mark int32 `json:"mark"` - TFO *bool `json:"tcpFastOpen"` - TProxy string `json:"tproxy"` - AcceptProxyProtocol bool `json:"acceptProxyProtocol"` - - TCPKeepAliveInterval int32 `json:"tcpKeepAliveInterval"` + Mark int32 `json:"mark"` + TFO *bool `json:"tcpFastOpen"` + TProxy string `json:"tproxy"` + AcceptProxyProtocol bool `json:"acceptProxyProtocol"` + TCPKeepAliveInterval int32 `json:"tcpKeepAliveInterval"` } // Build implements Buildable.