mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-11 18:38:50 +00:00
Do scheme validation in the client
This commit is contained in:
parent
b72d31f87f
commit
c68c78d412
@ -52,6 +52,10 @@ type ProtocolClient struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *ProtocolClient) connect() error {
|
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)
|
conn, err := tls.Dial("tcp", c.URI.Host, c.config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -15,6 +15,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func GetInvitationFromRelay(uri *url.URL, id syncthingprotocol.DeviceID, certs []tls.Certificate) (protocol.SessionInvitation, error) {
|
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, err := tls.Dial("tcp", uri.Host, configForCerts(certs))
|
||||||
conn.SetDeadline(time.Now().Add(10 * time.Second))
|
conn.SetDeadline(time.Now().Add(10 * time.Second))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user