1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-19 10:26:10 -04:00
v2fly/proxy/dokodemo/json/json.go

37 lines
921 B
Go
Raw Normal View History

2015-12-06 12:21:15 -05:00
package json
import (
v2net "github.com/v2ray/v2ray-core/common/net"
v2netjson "github.com/v2ray/v2ray-core/common/net/json"
"github.com/v2ray/v2ray-core/proxy/common/config/json"
)
type DokodemoConfig struct {
Host *v2netjson.Host `json:"address"`
2015-12-06 12:21:15 -05:00
Port v2net.Port `json:"port"`
NetworkList *v2netjson.NetworkList `json:"network"`
TimeoutValue int `json:"timeout"`
}
func (this *DokodemoConfig) Address() v2net.Address {
if this.Host.IsIP() {
return v2net.IPAddress(this.Host.IP(), this.Port)
2015-12-06 12:21:15 -05:00
} else {
return v2net.DomainAddress(this.Host.Domain(), this.Port)
2015-12-06 12:21:15 -05:00
}
}
func (this *DokodemoConfig) Network() v2net.NetworkList {
return this.NetworkList
}
func (this *DokodemoConfig) Timeout() int {
return this.TimeoutValue
}
func init() {
json.RegisterInboundConnectionConfig("dokodemo-door", func() interface{} {
return new(DokodemoConfig)
})
}