in proxy.go [127:179]
func enableTCPReset(httpMethod, requestURI, apiVersion string, input []byte) (output []byte, err error) {
if !strings.EqualFold(httpMethod, "PUT") ||
strings.Compare(apiVersion, "2018-07-01") < 0 {
return input, nil
}
var resourceType, _ = getResourceType(requestURI)
if !strings.EqualFold(resourceType, "Microsoft.Network/loadBalancers") {
return input, nil
}
var jsonBody map[string]interface{}
if err := json.Unmarshal(input, &jsonBody); err != nil {
return input, nil
}
sku := jsonBody["sku"]
if sku == nil || !strings.EqualFold(sku.(map[string]interface{})["name"].(string), "Standard") {
return input, nil
}
if jsonBody["properties"] == nil {
return input, nil
}
properties := jsonBody["properties"].(map[string]interface{})
if properties != nil && properties["loadBalancingRules"] != nil {
loadBalancingRules := properties["loadBalancingRules"].([]interface{})
for _, lbrule := range loadBalancingRules {
rule := lbrule.(map[string]interface{})
setEnableTCPReset(rule["properties"].(map[string]interface{}))
}
}
if properties != nil && properties["outboundRules"] != nil {
outboundRules := properties["outboundRules"].([]interface{})
for _, obrule := range outboundRules {
rule := obrule.(map[string]interface{})
setEnableTCPReset(rule["properties"].(map[string]interface{}))
}
}
if properties != nil && properties["inboundNatRules"] != nil {
inboundNatRules := properties["inboundNatRules"].([]interface{})
for _, natrule := range inboundNatRules {
rule := natrule.(map[string]interface{})
setEnableTCPReset(rule["properties"].(map[string]interface{}))
}
}
return json.Marshal(jsonBody)
}