Do scheme validation in the client

This commit is contained in:
Audrius Butkevicius
2015-06-28 20:34:28 +01:00
parent b72d31f87f
commit c68c78d412
2 changed files with 8 additions and 0 deletions

View File

@@ -15,6 +15,10 @@ import (
)
func GetInvitationFromRelay(uri *url.URL, id syncthingprotocol.DeviceID, certs []tls.Certificate) (protocol.SessionInvitation, error) {
if uri.Scheme != "relay" {
return protocol.SessionInvitation{}, fmt.Errorf("Unsupported relay schema:", uri.Scheme)
}
conn, err := tls.Dial("tcp", uri.Host, configForCerts(certs))
conn.SetDeadline(time.Now().Add(10 * time.Second))
if err != nil {