diff options
Diffstat (limited to 'internal/httpclient')
-rw-r--r-- | internal/httpclient/client.go | 3 | ||||
-rw-r--r-- | internal/httpclient/sanitizer.go | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/internal/httpclient/client.go b/internal/httpclient/client.go index 95071534c..84076a97e 100644 --- a/internal/httpclient/client.go +++ b/internal/httpclient/client.go @@ -36,6 +36,9 @@ import ( // ErrInvalidRequest is returned if a given HTTP request is invalid and cannot be performed. var ErrInvalidRequest = errors.New("invalid http request") +// ErrInvalidNetwork is returned if the request would not be performed over TCP +var ErrInvalidNetwork = errors.New("invalid network type") + // ErrReservedAddr is returned if a dialed address resolves to an IP within a blocked or reserved net. var ErrReservedAddr = errors.New("dial within blocked / reserved IP range") diff --git a/internal/httpclient/sanitizer.go b/internal/httpclient/sanitizer.go index 6eef6898a..75c0b34b9 100644 --- a/internal/httpclient/sanitizer.go +++ b/internal/httpclient/sanitizer.go @@ -38,6 +38,10 @@ func (s *sanitizer) Sanitize(ntwrk, addr string, _ syscall.RawConn) error { return err } + if !(ntwrk == "tcp4" || ntwrk == "tcp6") { + return ErrInvalidNetwork + } + // Seperate the IP ip := ipport.Addr() |