config.go 389 B

1234567891011121314151617
  1. //go:build linux || darwin
  2. package libbox
  3. import (
  4. "github.com/sagernet/sing-box/option"
  5. E "github.com/sagernet/sing/common/exceptions"
  6. )
  7. func parseConfig(configContent string) (option.Options, error) {
  8. var options option.Options
  9. err := options.UnmarshalJSON([]byte(configContent))
  10. if err != nil {
  11. return option.Options{}, E.Cause(err, "decode config")
  12. }
  13. return options, nil
  14. }