2016-01-15 06:43:06 -05:00
|
|
|
// +build json
|
|
|
|
|
|
|
|
package http
|
|
|
|
|
|
|
|
import (
|
2016-01-26 05:28:09 -05:00
|
|
|
"encoding/json"
|
2016-06-11 16:52:37 -04:00
|
|
|
"errors"
|
2016-01-26 05:28:09 -05:00
|
|
|
|
2016-06-10 16:26:39 -04:00
|
|
|
"github.com/v2ray/v2ray-core/proxy/internal"
|
2016-01-15 06:43:06 -05:00
|
|
|
)
|
|
|
|
|
2016-05-29 10:46:31 -04:00
|
|
|
// UnmarshalJSON implements json.Unmarshaler
|
2016-01-26 05:28:09 -05:00
|
|
|
func (this *Config) UnmarshalJSON(data []byte) error {
|
|
|
|
type JsonConfig struct {
|
|
|
|
}
|
|
|
|
jsonConfig := new(JsonConfig)
|
|
|
|
if err := json.Unmarshal(data, jsonConfig); err != nil {
|
2016-06-11 16:52:37 -04:00
|
|
|
return errors.New("HTTP: Failed to parse config: " + err.Error())
|
2016-01-26 05:28:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2016-01-15 06:43:06 -05:00
|
|
|
func init() {
|
2016-06-10 16:26:39 -04:00
|
|
|
internal.RegisterInboundConfig("http", func() interface{} { return new(Config) })
|
2016-01-15 06:43:06 -05:00
|
|
|
}
|