mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-04-04 20:37:37 +03:00
refactor: Modular inbounds/outbounds
This commit is contained in:
parent
9f7683818f
commit
e233fd4fe5
152 changed files with 3116 additions and 2926 deletions
|
@ -1,40 +0,0 @@
|
|||
package option
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/sagernet/sing/common/json"
|
||||
)
|
||||
|
||||
type _Options struct {
|
||||
RawMessage json.RawMessage `json:"-"`
|
||||
Schema string `json:"$schema,omitempty"`
|
||||
Log *LogOptions `json:"log,omitempty"`
|
||||
DNS *DNSOptions `json:"dns,omitempty"`
|
||||
NTP *NTPOptions `json:"ntp,omitempty"`
|
||||
Inbounds []Inbound `json:"inbounds,omitempty"`
|
||||
Outbounds []Outbound `json:"outbounds,omitempty"`
|
||||
Route *RouteOptions `json:"route,omitempty"`
|
||||
Experimental *ExperimentalOptions `json:"experimental,omitempty"`
|
||||
}
|
||||
|
||||
type Options _Options
|
||||
|
||||
func (o *Options) UnmarshalJSON(content []byte) error {
|
||||
decoder := json.NewDecoder(bytes.NewReader(content))
|
||||
decoder.DisallowUnknownFields()
|
||||
err := decoder.Decode((*_Options)(o))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
o.RawMessage = content
|
||||
return nil
|
||||
}
|
||||
|
||||
type LogOptions struct {
|
||||
Disabled bool `json:"disabled,omitempty"`
|
||||
Level string `json:"level,omitempty"`
|
||||
Output string `json:"output,omitempty"`
|
||||
Timestamp bool `json:"timestamp,omitempty"`
|
||||
DisableColor bool `json:"-"`
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue