You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/proxy/http/config_json.go

29 lines
588 B

// +build json
package http
import (
"encoding/json"
"errors"
"v2ray.com/core/proxy/registry"
)
// UnmarshalJSON implements json.Unmarshaler
8 years ago
func (this *ServerConfig) UnmarshalJSON(data []byte) error {
type JsonConfig struct {
8 years ago
Timeout uint32 `json:"timeout"`
}
jsonConfig := new(JsonConfig)
if err := json.Unmarshal(data, jsonConfig); err != nil {
return errors.New("HTTP: Failed to parse config: " + err.Error())
}
this.Timeout = jsonConfig.Timeout
return nil
}
func init() {
8 years ago
registry.RegisterInboundConfig("http", func() interface{} { return new(ServerConfig) })
}