mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-21 07:07:08 +00:00
Simpilify configuration files
This commit is contained in:
1 parent
78daf8a879
commit
72b4eeba8b
27 files changed
+251
-208
No files matched your search
+10
-11
@@ -1,12 +1,13 @@
|
||||
package vmess
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
"github.com/v2ray/v2ray-core/common/log"
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
"github.com/v2ray/v2ray-core/config"
|
||||
"github.com/v2ray/v2ray-core/config/json"
|
||||
"github.com/v2ray/v2ray-core/proxy/vmess/protocol/user"
|
||||
)
|
||||
|
||||
@@ -29,12 +30,6 @@ type VMessInboundConfig struct {
|
||||
UDPEnabled bool `json:"udp"`
|
||||
}
|
||||
|
||||
func loadInboundConfig(rawConfig []byte) (VMessInboundConfig, error) {
|
||||
config := VMessInboundConfig{}
|
||||
err := json.Unmarshal(rawConfig, &config)
|
||||
return config, err
|
||||
}
|
||||
|
||||
type VNextConfig struct {
|
||||
Address string `json:"address"`
|
||||
Port uint16 `json:"port"`
|
||||
@@ -76,8 +71,12 @@ type VMessOutboundConfig struct {
|
||||
VNextList []VNextConfig `json:"vnext"`
|
||||
}
|
||||
|
||||
func loadOutboundConfig(rawConfig []byte) (VMessOutboundConfig, error) {
|
||||
config := VMessOutboundConfig{}
|
||||
err := json.Unmarshal(rawConfig, &config)
|
||||
return config, err
|
||||
func init() {
|
||||
json.RegisterConfigType("vmess", config.TypeInbound, func() interface{} {
|
||||
return new(VMessInboundConfig)
|
||||
})
|
||||
|
||||
json.RegisterConfigType("vmess", config.TypeOutbound, func() interface{} {
|
||||
return new(VMessOutboundConfig)
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user