File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,6 +82,11 @@ func NewClient(c *Config) (*Client, error) {
8282 if err != nil {
8383 return nil , err
8484 }
85+
86+ if ! regexp .MustCompile (`(slb\.com|slb-ds\.com|cluster\.local|localhost|-service|127\.0\.0\.1)[:\d]*$` ).MatchString (u .Host ) {
87+ return nil , errors .New ("Invalid URL " + u .Host )
88+ }
89+
8590 //swap to websockets scheme
8691 u .Scheme = strings .Replace (u .Scheme , "http" , "ws" , 1 )
8792 //apply default port
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ func TestCustomHeaders(t *testing.T) {
4747func TestFallbackLegacyFingerprint (t * testing.T ) {
4848 config := Config {
4949 Fingerprint : "a5:32:92:c6:56:7a:9e:61:26:74:1b:81:a6:f5:1b:44" ,
50+ Server : "http://localhost:9000" ,
5051 }
5152 c , err := NewClient (& config )
5253 if err != nil {
@@ -70,6 +71,7 @@ func TestFallbackLegacyFingerprint(t *testing.T) {
7071func TestVerifyLegacyFingerprint (t * testing.T ) {
7172 config := Config {
7273 Fingerprint : "a5:32:92:c6:56:7a:9e:61:26:74:1b:81:a6:f5:1b:44" ,
74+ Server : "http://localhost:9000" ,
7375 }
7476 c , err := NewClient (& config )
7577 if err != nil {
@@ -93,6 +95,7 @@ func TestVerifyLegacyFingerprint(t *testing.T) {
9395func TestVerifyFingerprint (t * testing.T ) {
9496 config := Config {
9597 Fingerprint : "qmrRoo8MIqePv3jC8+wv49gU6uaFgD3FASQx9V8KdmY=" ,
98+ Server : "http://localhost:9000" ,
9699 }
97100 c , err := NewClient (& config )
98101 if err != nil {
You can’t perform that action at this time.
0 commit comments