Skip to content
Snippets Groups Projects
Verified Commit bcdc6296 authored by Pea Nut's avatar Pea Nut
Browse files

Revert "Return a list of ports for /gateway endpoints"

This reverts commit c6a2084c.
parent 91358b79
No related branches found
No related tags found
1 merge request!31Revert "Return a list of ports for /gateway endpoints"
Pipeline #222395 failed
......@@ -205,7 +205,7 @@ func maybeAddGatewayFilter(c echo.Context, param string, filters []func(*m.Gatew
return filters
}
filter = func(gw *m.Gateway) bool {
return slices.Contains(gw.Ports, port)
return gw.Port == port
}
case "loc":
filter = func(gw *m.Gateway) bool {
......
......@@ -102,14 +102,11 @@ func newRegistry(cfg *Config) (*registry, error) {
}
loc := m.CanonicalizeLocation(g.Location)
newGateway := &m.Gateway{
Healthy: true,
Host: g.Host,
IPAddr: g.IPAddr,
Location: loc,
// TODO: adding a list here with ports is what we want
// Should be transport.Ports to be precise.
// But then we should handle it as one Gateway, that is added to the registry
Ports: []int{p},
Healthy: true,
Host: g.Host,
IPAddr: g.IPAddr,
Location: loc,
Port: p,
Transport: proto,
Type: string(transportOpenVPN),
}
......
......@@ -75,7 +75,7 @@ func SerializeConfig(rawCert string, ca string, remote *models.Gateway) (string,
Cert: crt,
Key: key,
IPAddr: remote.IPAddr,
Port: fmt.Sprintf("%d", remote.Ports[0]),
Port: fmt.Sprintf("%d", remote.Port),
Transport: remote.Transport,
}
tmpl, err := template.New("openvpncert").Parse(openvpnConfigTemplate)
......
......@@ -66,10 +66,8 @@ type Gateway struct {
Location string `json:"location"`
// Overloaded should be set to true if the fractional load is above threshold.
Overloaded bool `json:"overloaded"`
// List of ports this gateway is listening on. The order of the ports is used
// for load balancing the gateway. The client should use the ports in the order
// it receives them (first port in the list is the preferred port)
Ports []int `json:"ports"`
// The (primary) port this gateway is listening on.
Port int `json:"port"`
// TCP, UDP or KCP. This was called "protocol" in previous versions of the API.
Transport string `json:"transport"`
// Type is the type of gateway. The only valid type as of 2023 is openvpn.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment