From 3bf3d96472f5d1d20bd9797887a310b66fe587af Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Fri, 22 Oct 2021 00:01:31 -0400 Subject: [PATCH] Fix: JSON tag case (#1212) (#778) JSON unmarshal is case insensitive in Golang Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com> --- infra/conf/transport_internet.go | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/infra/conf/transport_internet.go b/infra/conf/transport_internet.go index cac20522..57ef057b 100644 --- a/infra/conf/transport_internet.go +++ b/infra/conf/transport_internet.go @@ -141,7 +141,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"` } @@ -149,9 +148,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{ @@ -503,14 +499,13 @@ func (p TransportProtocol) Build() (string, error) { } type SocketConfig struct { - Mark int32 `json:"mark"` - TFO interface{} `json:"tcpFastOpen"` - TProxy string `json:"tproxy"` - AcceptProxyProtocol bool `json:"acceptProxyProtocol"` - DomainStrategy string `json:"domainStrategy"` - DialerProxy string `json:"dialerProxy"` - - TCPKeepAliveInterval int32 `json:"tcpKeepAliveInterval"` + Mark int32 `json:"mark"` + TFO interface{} `json:"tcpFastOpen"` + TProxy string `json:"tproxy"` + AcceptProxyProtocol bool `json:"acceptProxyProtocol"` + DomainStrategy string `json:"domainStrategy"` + DialerProxy string `json:"dialerProxy"` + TCPKeepAliveInterval int32 `json:"tcpKeepAliveInterval"` } // Build implements Buildable.