add turn config to host model

This commit is contained in:
Abhishek Kondur 2023-03-22 12:05:51 +04:00
parent 91b4d237c8
commit 851fdbfee1
3 changed files with 14 additions and 8 deletions

View file

@ -97,6 +97,8 @@ func GetProxyUpdateForHost(ctx context.Context, host *models.Host) (models.Proxy
Proxy: peerHost.ProxyEnabled,
PublicListenPort: int32(GetPeerListenPort(peerHost)),
ProxyListenPort: GetProxyListenPort(peerHost),
ShouldUseTurn: peerHost.ShouldUseTurn,
TurnRelayAddr: peerHost.TurnRelayAddr,
}
}

View file

@ -54,6 +54,8 @@ type Host struct {
Interfaces []Iface `json:"interfaces" yaml:"interfaces"`
DefaultInterface string `json:"defaultinterface" yaml:"defaultinterface"`
EndpointIP net.IP `json:"endpointip" yaml:"endpointip"`
ShouldUseTurn bool `json:"should_use_turn" yaml:"should_use_turn"`
TurnRelayAddr net.PacketConn `json:"turn_relay_addr" yaml:"turn_relay_addr"`
ProxyEnabled bool `json:"proxy_enabled" yaml:"proxy_enabled"`
ProxyEnabledSet bool `json:"proxy_enabled_updated" yaml:"proxy_enabled_updated"`
IsDocker bool `json:"isdocker" yaml:"isdocker"`

View file

@ -35,14 +35,16 @@ type RelayedConf struct {
// PeerConf - struct for peer config in the network
type PeerConf struct {
Proxy bool `json:"proxy"`
PublicListenPort int32 `json:"public_listen_port"`
ProxyListenPort int `json:"proxy_listen_port"`
IsExtClient bool `json:"is_ext_client"`
Address net.IP `json:"address"`
ExtInternalIp net.IP `json:"ext_internal_ip"`
IsRelayed bool `json:"is_relayed"`
RelayedTo *net.UDPAddr `json:"relayed_to"`
Proxy bool `json:"proxy"`
PublicListenPort int32 `json:"public_listen_port"`
ProxyListenPort int `json:"proxy_listen_port"`
IsExtClient bool `json:"is_ext_client"`
Address net.IP `json:"address"`
ExtInternalIp net.IP `json:"ext_internal_ip"`
IsRelayed bool `json:"is_relayed"`
RelayedTo *net.UDPAddr `json:"relayed_to"`
ShouldUseTurn bool `json:"should_use_turn"`
TurnRelayAddr net.PacketConn `json:"turn_relay_addr"`
}
// ProxyManagerPayload - struct for proxy manager payload