mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-10 07:37:33 +02:00
add support for TCP routes (#1695)
This commit is contained in:
parent
64816720c8
commit
ad828c6e84
7 changed files with 86 additions and 13 deletions
|
@ -84,6 +84,10 @@ func GetAbsoluteURL(r *http.Request) *url.URL {
|
|||
// For standard HTTP (80)/HTTPS (443) ports, it returns `example.com` and `example.com:<port>`.
|
||||
// Otherwise, return the URL.Host value.
|
||||
func GetDomainsForURL(u *url.URL) []string {
|
||||
if IsTCP(u) {
|
||||
return []string{u.Host}
|
||||
}
|
||||
|
||||
var defaultPort string
|
||||
if u.Scheme == "http" {
|
||||
defaultPort = "80"
|
||||
|
@ -102,6 +106,11 @@ func GetDomainsForURL(u *url.URL) []string {
|
|||
return []string{u.Hostname(), net.JoinHostPort(u.Hostname(), defaultPort)}
|
||||
}
|
||||
|
||||
// IsTCP returns whether or not the given URL is for TCP via HTTP Connect.
|
||||
func IsTCP(u *url.URL) bool {
|
||||
return u.Scheme == "tcp+http" || u.Scheme == "tcp+https"
|
||||
}
|
||||
|
||||
// ParseEnvoyQueryParams returns a new URL with queryparams parsed from envoy format.
|
||||
func ParseEnvoyQueryParams(u *url.URL) *url.URL {
|
||||
nu := &url.URL{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue