This commit is contained in:
2025-10-17 18:13:49 +11:00
parent be656cca57
commit 1e8a79c2d2
21 changed files with 186 additions and 132 deletions

View File

@@ -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"`