Improve the strict configuration validation (#3809)

This commit is contained in:
fatedier
2023-11-28 18:43:33 +08:00
committed by GitHub
parent 7c799ee921
commit 38f297a395
7 changed files with 102 additions and 6 deletions

View File

@@ -15,9 +15,23 @@
package v1
import (
"sync"
"github.com/fatedier/frp/pkg/util/util"
)
// TODO(fatedier): Due to the current implementation issue of the go json library, the UnmarshalJSON method
// of a custom struct cannot access the DisallowUnknownFields parameter of the parent decoder.
// Here, a global variable is temporarily used to control whether unknown fields are allowed.
// Once the v2 version is implemented by the community, we can switch to a standardized approach.
//
// https://github.com/golang/go/issues/41144
// https://github.com/golang/go/discussions/63397
var (
DisallowUnknownFields = false
DisallowUnknownFieldsMu sync.Mutex
)
type AuthScope string
const (