ParseURL creates a [Spec] from the given ssh URL. It returns an error if the URL is using the wrong scheme, contains fragments, query-parameters, or contains a password.
(daemonURL string)
| 13 | // the URL is using the wrong scheme, contains fragments, query-parameters, |
| 14 | // or contains a password. |
| 15 | func ParseURL(daemonURL string) (*Spec, error) { |
| 16 | u, err := url.Parse(daemonURL) |
| 17 | if err != nil { |
| 18 | var urlErr *url.Error |
| 19 | if errors.As(err, &urlErr) { |
| 20 | err = urlErr.Unwrap() |
| 21 | } |
| 22 | return nil, fmt.Errorf("invalid SSH URL: %w", err) |
| 23 | } |
| 24 | return NewSpec(u) |
| 25 | } |
| 26 | |
| 27 | // NewSpec creates a [Spec] from the given ssh URL's properties. It returns |
| 28 | // an error if the URL is using the wrong scheme, contains fragments, |
searching dependent graphs…