Completed core connection wrapper.
This commit is contained in:
20
ws/url.go
Normal file
20
ws/url.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package ws
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
|
||||
"git.wisehodl.dev/jay/go-honeybee/errors"
|
||||
)
|
||||
|
||||
func ParseURL(urlStr string) (*url.URL, error) {
|
||||
parsedURL, err := url.Parse(urlStr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if parsedURL.Scheme != "ws" && parsedURL.Scheme != "wss" {
|
||||
return nil, errors.InvalidProtocol
|
||||
}
|
||||
|
||||
return parsedURL, nil
|
||||
}
|
||||
Reference in New Issue
Block a user