Ordered json output & Disallow unknown fields

This commit is contained in:
世界
2022-07-03 11:28:15 +08:00
parent 85a695caa1
commit ef5cfd59d4
16 changed files with 243 additions and 26 deletions

View File

@@ -1,8 +1,7 @@
package option
import (
"encoding/json"
"github.com/goccy/go-json"
E "github.com/sagernet/sing/common/exceptions"
M "github.com/sagernet/sing/common/metadata"
)
@@ -43,7 +42,11 @@ func (h *Outbound) UnmarshalJSON(bytes []byte) error {
default:
return nil
}
return json.Unmarshal(bytes, v)
err = UnmarshallExcluded(bytes, (*_Outbound)(h), v)
if err != nil {
return E.Cause(err, "outbound options")
}
return nil
}
type DialerOptions struct {