Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
menshen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leap
menshen
Commits
bcdc6296
Verified
Commit
bcdc6296
authored
7 months ago
by
Pea Nut
Browse files
Options
Downloads
Patches
Plain Diff
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
!31
Revert "Return a list of ports for /gateway endpoints"
Pipeline
#222395
failed
7 months ago
Stage: test
Stage: build
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
pkg/api/gateway.go
+1
-1
1 addition, 1 deletion
pkg/api/gateway.go
pkg/api/registry.go
+5
-8
5 additions, 8 deletions
pkg/api/registry.go
pkg/genconfig/serialize.go
+1
-1
1 addition, 1 deletion
pkg/genconfig/serialize.go
pkg/models/resources.go
+2
-4
2 additions, 4 deletions
pkg/models/resources.go
with
9 additions
and
14 deletions
pkg/api/gateway.go
+
1
−
1
View file @
bcdc6296
...
...
@@ -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
.
Port
s
,
port
)
return
gw
.
Port
==
port
}
case
"loc"
:
filter
=
func
(
gw
*
m
.
Gateway
)
bool
{
...
...
This diff is collapsed.
Click to expand it.
pkg/api/registry.go
+
5
−
8
View file @
bcdc6296
...
...
@@ -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
),
}
...
...
This diff is collapsed.
Click to expand it.
pkg/genconfig/serialize.go
+
1
−
1
View file @
bcdc6296
...
...
@@ -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
.
Port
s
[
0
]
),
Port
:
fmt
.
Sprintf
(
"%d"
,
remote
.
Port
),
Transport
:
remote
.
Transport
,
}
tmpl
,
err
:=
template
.
New
(
"openvpncert"
)
.
Parse
(
openvpnConfigTemplate
)
...
...
This diff is collapsed.
Click to expand it.
pkg/models/resources.go
+
2
−
4
View file @
bcdc6296
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment