From 46acf1d336388c34e4b02e68931baad140ad35d3 Mon Sep 17 00:00:00 2001 From: Abhishek K <32607604+abhishek9686@users.noreply.github.com> Date: Tue, 16 May 2023 01:10:34 +0530 Subject: [PATCH] NET-129: Turn Signal Actions (#2290) * add signal action field * add negotiation signal action * typo fix * change signal action name --- models/host.go | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/models/host.go b/models/host.go index 51c6d43e..d606ddd3 100644 --- a/models/host.go +++ b/models/host.go @@ -121,6 +121,16 @@ const ( UpdateKeys = "UPDATE_KEYS" ) +// SignalAction - turn peer signal action +type SignalAction string + +const ( + // Disconnect - action to stop using turn connection + Disconnect SignalAction = "DISCONNECT" + // ConnNegotiation - action to negotiate connection between peers + ConnNegotiation SignalAction = "CONNECTION_NEGOTIATION" +) + // HostUpdate - struct for host update type HostUpdate struct { Action HostMqAction @@ -137,11 +147,12 @@ type HostTurnRegister struct { // Signal - struct for signalling peer type Signal struct { - Server string `json:"server"` - FromHostPubKey string `json:"from_host_pubkey"` - TurnRelayEndpoint string `json:"turn_relay_addr"` - ToHostPubKey string `json:"to_host_pubkey"` - Reply bool `json:"reply"` + Server string `json:"server"` + FromHostPubKey string `json:"from_host_pubkey"` + TurnRelayEndpoint string `json:"turn_relay_addr"` + ToHostPubKey string `json:"to_host_pubkey"` + Reply bool `json:"reply"` + Action SignalAction `json:"action"` } // RegisterMsg - login message struct for hosts to join via SSO login