mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-16 07:46:36 +08:00
临时提交
This commit is contained in:
22
internal/configs/protocol_tcp_config.go
Normal file
22
internal/configs/protocol_tcp_config.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package configs
|
||||
|
||||
type TCPProtocolConfig struct {
|
||||
IsOn bool `yaml:"isOn"` // 是否开启
|
||||
IPVersion IPVersion `yaml:"ipVersion"` // 4, 6
|
||||
Listen []string `yaml:"listen" json:"listen"` // 监听地址
|
||||
}
|
||||
|
||||
func (this *TCPProtocolConfig) Addresses() []string {
|
||||
result := []string{}
|
||||
for _, listen := range this.Listen {
|
||||
switch this.IPVersion {
|
||||
case IPv4:
|
||||
result = append(result, ProtocolTCP4+"://"+listen)
|
||||
case IPv6:
|
||||
result = append(result, ProtocolTCP6+"://"+listen)
|
||||
default:
|
||||
result = append(result, ProtocolTCP+"://"+listen)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user