mirror of
https://github.com/bestnite/sub2clash.git
synced 2025-10-26 17:14:24 +00:00
This commit is contained in:
@@ -2,10 +2,31 @@ package proxy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type IntOrString int
|
||||
|
||||
func (i *IntOrString) UnmarshalYAML(value *yaml.Node) error {
|
||||
intVal := 0
|
||||
err := yaml.Unmarshal([]byte(value.Value), &intVal)
|
||||
if err == nil {
|
||||
*i = IntOrString(intVal)
|
||||
}
|
||||
strVal := ""
|
||||
err = yaml.Unmarshal([]byte(value.Value), &strVal)
|
||||
if err == nil {
|
||||
_int, err := strconv.ParseInt(strVal, 10, 64)
|
||||
if err != nil {
|
||||
*i = IntOrString(_int)
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type HTTPOptions struct {
|
||||
Method string `yaml:"method,omitempty"`
|
||||
Path []string `yaml:"path,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user