generated from PenaSide/GolangTemplate
added todo
This commit is contained in:
parent
03d8af8332
commit
2eff1775f9
@ -9,7 +9,6 @@ import (
|
|||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"github.com/twmb/franz-go/pkg/kgo"
|
"github.com/twmb/franz-go/pkg/kgo"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -77,9 +76,10 @@ func validateURLs(urls []string) error {
|
|||||||
return fmt.Errorf("empty url, index: %d", index)
|
return fmt.Errorf("empty url, index: %d", index)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ip := net.ParseIP(u); ip == nil {
|
// todo проверять урлы
|
||||||
return fmt.Errorf("invalid url: %s", u)
|
//if ip := net.Pa(u); ip == nil {
|
||||||
}
|
// return fmt.Errorf("invalid url: %s", u)
|
||||||
|
//}
|
||||||
// todo check the liveness of these URLs, many services do not support
|
// todo check the liveness of these URLs, many services do not support
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -20,3 +20,21 @@ func TestValidateMail(t *testing.T) {
|
|||||||
})
|
})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestValidateURLs(t *testing.T) {
|
||||||
|
urls := []string{
|
||||||
|
"http://10.8.0.6:59300",
|
||||||
|
"http://10.8.0.6:59303",
|
||||||
|
"http://10.8.0.6:3131",
|
||||||
|
"10.8.0.6:9001",
|
||||||
|
"10.8.0.6:9085",
|
||||||
|
"http://10.8.0.6:7036",
|
||||||
|
"http://10.6.0.17",
|
||||||
|
"https://api.smtp.bz/v1/smtp/send",
|
||||||
|
"10.8.0.6:59665",
|
||||||
|
"https://sadmin.pena",
|
||||||
|
"10.8.0.15:7113",
|
||||||
|
}
|
||||||
|
err := validateURLs(urls)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user