get rid of annoying firewall warnings

This commit is contained in:
v2ray committed 2016-05-29 16:37:52 +02:00
1 parent c3aa839227
commit b47c1ca609
34 files changed
+110 -51

No files matched your search

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