feat: 支持自定义请求 Header
This commit is contained in:
@@ -34,4 +34,5 @@ type SettingsConf struct {
|
|||||||
Guardian GuardianConf `json:"guardian" yaml:"guardian"`
|
Guardian GuardianConf `json:"guardian" yaml:"guardian"`
|
||||||
Log LogConf `json:"log" yaml:"log"`
|
Log LogConf `json:"log" yaml:"log"`
|
||||||
DDNS DdnsConf `json:"ddns" yaml:"ddns"`
|
DDNS DdnsConf `json:"ddns" yaml:"ddns"`
|
||||||
|
CustomHeader map[string]interface{} `json:"custom_header" yaml:"custom_header"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
@@ -31,7 +32,9 @@ func (Json) Marshal(v any) ([]byte, error) {
|
|||||||
return json.MarshalIndent(v, "", " ")
|
return json.MarshalIndent(v, "", " ")
|
||||||
}
|
}
|
||||||
func (Json) Unmarshal(data []byte, v any) error {
|
func (Json) Unmarshal(data []byte, v any) error {
|
||||||
return json.Unmarshal(data, v)
|
jsonDecoder := json.NewDecoder(bytes.NewReader(data))
|
||||||
|
jsonDecoder.UseNumber()
|
||||||
|
return jsonDecoder.Decode(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Yaml struct {
|
type Yaml struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user