mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-11 10:38:16 +00:00
Do scheme validation in the client
This commit is contained in:
parent
b72d31f87f
commit
c68c78d412
client
@ -52,6 +52,10 @@ type ProtocolClient struct {
|
||||
}
|
||||
|
||||
func (c *ProtocolClient) connect() error {
|
||||
if c.URI.Scheme != "relay" {
|
||||
return fmt.Errorf("Unsupported relay schema:", c.URI.Scheme)
|
||||
}
|
||||
|
||||
conn, err := tls.Dial("tcp", c.URI.Host, c.config)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user