|
@@ -4,6 +4,7 @@ package point
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
"encoding/json"
|
|
"encoding/json"
|
|
|
|
|
+ "errors"
|
|
|
"io/ioutil"
|
|
"io/ioutil"
|
|
|
"os"
|
|
"os"
|
|
|
"strings"
|
|
"strings"
|
|
@@ -21,6 +22,7 @@ const (
|
|
|
func (this *Config) UnmarshalJSON(data []byte) error {
|
|
func (this *Config) UnmarshalJSON(data []byte) error {
|
|
|
type JsonConfig struct {
|
|
type JsonConfig struct {
|
|
|
Port v2net.Port `json:"port"` // Port of this Point server.
|
|
Port v2net.Port `json:"port"` // Port of this Point server.
|
|
|
|
|
+ ListenOn *v2net.AddressJson `json:"listen"`
|
|
|
LogConfig *LogConfig `json:"log"`
|
|
LogConfig *LogConfig `json:"log"`
|
|
|
RouterConfig *router.Config `json:"routing"`
|
|
RouterConfig *router.Config `json:"routing"`
|
|
|
DNSConfig *dns.Config `json:"dns"`
|
|
DNSConfig *dns.Config `json:"dns"`
|
|
@@ -34,6 +36,13 @@ func (this *Config) UnmarshalJSON(data []byte) error {
|
|
|
return err
|
|
return err
|
|
|
}
|
|
}
|
|
|
this.Port = jsonConfig.Port
|
|
this.Port = jsonConfig.Port
|
|
|
|
|
+ this.ListenOn = v2net.AnyIP
|
|
|
|
|
+ if jsonConfig.ListenOn != nil {
|
|
|
|
|
+ if jsonConfig.ListenOn.Address.IsDomain() {
|
|
|
|
|
+ return errors.New("Point: Unable to listen on domain address: " + jsonConfig.ListenOn.Address.Domain())
|
|
|
|
|
+ }
|
|
|
|
|
+ this.ListenOn = jsonConfig.ListenOn.Address
|
|
|
|
|
+ }
|
|
|
this.LogConfig = jsonConfig.LogConfig
|
|
this.LogConfig = jsonConfig.LogConfig
|
|
|
this.RouterConfig = jsonConfig.RouterConfig
|
|
this.RouterConfig = jsonConfig.RouterConfig
|
|
|
this.InboundConfig = jsonConfig.InboundConfig
|
|
this.InboundConfig = jsonConfig.InboundConfig
|
|
@@ -125,6 +134,7 @@ func (this *InboundDetourConfig) UnmarshalJSON(data []byte) error {
|
|
|
type JsonInboundDetourConfig struct {
|
|
type JsonInboundDetourConfig struct {
|
|
|
Protocol string `json:"protocol"`
|
|
Protocol string `json:"protocol"`
|
|
|
PortRange *v2net.PortRange `json:"port"`
|
|
PortRange *v2net.PortRange `json:"port"`
|
|
|
|
|
+ ListenOn *v2net.AddressJson `json:"listen"`
|
|
|
Settings json.RawMessage `json:"settings"`
|
|
Settings json.RawMessage `json:"settings"`
|
|
|
Tag string `json:"tag"`
|
|
Tag string `json:"tag"`
|
|
|
Allocation *InboundDetourAllocationConfig `json:"allocate"`
|
|
Allocation *InboundDetourAllocationConfig `json:"allocate"`
|
|
@@ -137,6 +147,13 @@ func (this *InboundDetourConfig) UnmarshalJSON(data []byte) error {
|
|
|
log.Error("Point: Port range not specified in InboundDetour.")
|
|
log.Error("Point: Port range not specified in InboundDetour.")
|
|
|
return ErrorBadConfiguration
|
|
return ErrorBadConfiguration
|
|
|
}
|
|
}
|
|
|
|
|
+ this.ListenOn = v2net.AnyIP
|
|
|
|
|
+ if jsonConfig.ListenOn != nil {
|
|
|
|
|
+ if jsonConfig.ListenOn.Address.IsDomain() {
|
|
|
|
|
+ return errors.New("Point: Unable to listen on domain address: " + jsonConfig.ListenOn.Address.Domain())
|
|
|
|
|
+ }
|
|
|
|
|
+ this.ListenOn = jsonConfig.ListenOn.Address
|
|
|
|
|
+ }
|
|
|
this.Protocol = jsonConfig.Protocol
|
|
this.Protocol = jsonConfig.Protocol
|
|
|
this.PortRange = *jsonConfig.PortRange
|
|
this.PortRange = *jsonConfig.PortRange
|
|
|
this.Settings = jsonConfig.Settings
|
|
this.Settings = jsonConfig.Settings
|