We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 55073c4 commit 11b53daCopy full SHA for 11b53da
1 file changed
cli/connhelper/ssh/ssh.go
@@ -19,14 +19,24 @@ func ParseURL(daemonURL string) (*Spec, error) {
19
}
20
return nil, fmt.Errorf("invalid SSH URL: %w", err)
21
22
- s, err := newSpec(u)
+ return NewSpec(u)
23
+}
24
+
25
+// NewSpec creates a [Spec] from the given ssh URL's properties. It returns
26
+// an error if the URL is using the wrong scheme, contains fragments,
27
+// query-parameters, or contains a password.
28
+func NewSpec(sshURL *url.URL) (*Spec, error) {
29
+ s, err := newSpec(sshURL)
30
if err != nil {
31
32
33
return s, nil
34
35
36
func newSpec(u *url.URL) (*Spec, error) {
37
+ if u == nil {
38
+ return nil, errors.New("URL is nil")
39
+ }
40
if u.Scheme == "" {
41
return nil, errors.New("no scheme provided")
42
0 commit comments