add network map support for clustering

This commit is contained in:
pascal
2026-02-10 14:29:20 +01:00
parent 79fed32f01
commit a803f47685
13 changed files with 229 additions and 211 deletions

View File

@@ -49,9 +49,6 @@ type Target struct {
TargetId string `json:"target_id"`
TargetType string `json:"target_type"`
Enabled bool `json:"enabled"`
// AccessLocal indicates the resource is served locally on the router peer,
// requiring additional peer-level firewall rules for the proxy to access the router directly.
AccessLocal bool `json:"access_local"`
}
type PasswordAuthConfig struct {
@@ -156,14 +153,13 @@ func (r *ReverseProxy) ToAPIResponse() *api.ReverseProxy {
apiTargets := make([]api.ReverseProxyTarget, 0, len(r.Targets))
for _, target := range r.Targets {
apiTargets = append(apiTargets, api.ReverseProxyTarget{
Path: target.Path,
Host: &target.Host,
Port: target.Port,
Protocol: api.ReverseProxyTargetProtocol(target.Protocol),
TargetId: target.TargetId,
TargetType: api.ReverseProxyTargetTargetType(target.TargetType),
Enabled: target.Enabled,
AccessLocal: &target.AccessLocal,
Path: target.Path,
Host: &target.Host,
Port: target.Port,
Protocol: api.ReverseProxyTargetProtocol(target.Protocol),
TargetId: target.TargetId,
TargetType: api.ReverseProxyTargetTargetType(target.TargetType),
Enabled: target.Enabled,
})
}
@@ -282,15 +278,13 @@ func (r *ReverseProxy) FromAPIRequest(req *api.ReverseProxyRequest, accountID st
targets := make([]*Target, 0, len(req.Targets))
for _, apiTarget := range req.Targets {
accessLocal := apiTarget.AccessLocal != nil && *apiTarget.AccessLocal
target := &Target{
Path: apiTarget.Path,
Port: apiTarget.Port,
Protocol: string(apiTarget.Protocol),
TargetId: apiTarget.TargetId,
TargetType: string(apiTarget.TargetType),
Enabled: apiTarget.Enabled,
AccessLocal: accessLocal,
Path: apiTarget.Path,
Port: apiTarget.Port,
Protocol: string(apiTarget.Protocol),
TargetId: apiTarget.TargetId,
TargetType: string(apiTarget.TargetType),
Enabled: apiTarget.Enabled,
}
if apiTarget.Host != nil {
target.Host = *apiTarget.Host