From 919e758a31f1f1c44e5081d7570617b366e06b91 Mon Sep 17 00:00:00 2001 From: Simon Eisenmann Date: Fri, 28 Mar 2014 16:31:59 +0100 Subject: [PATCH] Removed obsolete different TURN user formats. --- server.conf.in | 1 - src/app/spreed-speakfreely-server/hub.go | 12 ++---------- src/app/spreed-speakfreely-server/main.go | 7 +------ 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/server.conf.in b/server.conf.in index 21983109..07bf5f80 100644 --- a/server.conf.in +++ b/server.conf.in @@ -16,7 +16,6 @@ listen = 127.0.0.1:8080 #stunURIs = stun.l.google.com:19302 #turnURIs = turn:turnserver:port?transport=udp turn:anotherturnserver:port?transport=tcp turns:turnserver:443?transport=tcp #turnSecret = the-default-turn-shared-secret-do-not-keep -#turnUsernameFormat = id:time # Set the format for turn username generator. Valid values are time:id, id:time (default). sessionSecret = the-default-secret-do-not-keep #tokenFile = tokens.txt # If set, everyone needs to give one of the tokens to launch the web client. One token per line in the file. #globalRoom = global # Enables a global room. Users in that room are in all rooms. diff --git a/src/app/spreed-speakfreely-server/hub.go b/src/app/spreed-speakfreely-server/hub.go index c11a0931..526747d9 100644 --- a/src/app/spreed-speakfreely-server/hub.go +++ b/src/app/spreed-speakfreely-server/hub.go @@ -69,7 +69,6 @@ type Hub struct { config *Config sessionSecret []byte turnSecret []byte - turnUsernameFormat string tickets *securecookie.SecureCookie count uint64 mutex sync.RWMutex @@ -78,7 +77,7 @@ type Hub struct { unicastChatMessages uint64 } -func NewHub(version string, config *Config, sessionSecret, turnSecret, turnUsernameFormat string) *Hub { +func NewHub(version string, config *Config, sessionSecret, turnSecret string) *Hub { h := &Hub{ connectionTable: make(map[string]*Connection), @@ -88,7 +87,6 @@ func NewHub(version string, config *Config, sessionSecret, turnSecret, turnUsern config: config, sessionSecret: []byte(sessionSecret), turnSecret: []byte(turnSecret), - turnUsernameFormat: turnUsernameFormat, } h.tickets = securecookie.New(h.sessionSecret, nil) @@ -141,18 +139,12 @@ func (h *Hub) CreateTurnData(id string) *DataTurn { if len(h.turnSecret) == 0 { return &DataTurn{} } - var user string bar := sha256.New() bar.Write([]byte(id)) id = base64.StdEncoding.EncodeToString(bar.Sum(nil)) foo := hmac.New(sha1.New, h.turnSecret) expiration := int32(time.Now().Unix())+turnTTL - switch h.turnUsernameFormat { - case "time:id": - user = fmt.Sprintf("%d:%s", expiration, id) - default: - user = fmt.Sprintf("%s:%d", id, expiration) - } + user := fmt.Sprintf("%d:%s", expiration, id) foo.Write([]byte(user)) password := base64.StdEncoding.EncodeToString(foo.Sum(nil)) return &DataTurn{user, password, turnTTL, h.config.TurnURIs} diff --git a/src/app/spreed-speakfreely-server/main.go b/src/app/spreed-speakfreely-server/main.go index c7cd406d..9265af23 100644 --- a/src/app/spreed-speakfreely-server/main.go +++ b/src/app/spreed-speakfreely-server/main.go @@ -211,11 +211,6 @@ func runner(runtime phoenix.Runtime) error { turnSecret = "" } - turnUsernameFormat, err := runtime.GetString("app", "turnUsernameFormat") - if err != nil { - turnUsernameFormat = "id:time" - } - stunURIsString, err := runtime.GetString("app", "stunURIs") if err != nil { stunURIsString = "" @@ -274,7 +269,7 @@ func runner(runtime phoenix.Runtime) error { } // Create our hub instance. - hub := NewHub(runtimeVersion, config, sessionSecret, turnSecret, turnUsernameFormat) + hub := NewHub(runtimeVersion, config, sessionSecret, turnSecret) // Set number of go routines if it is 1 if goruntime.GOMAXPROCS(0) == 1 {