1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import (
"fmt"
"github.com/johnandersen777/socialweb-computer-kcp/api/v1alpha1"
)
func applyIngressOption(ingress *v1alpha1.IngressConfig, name, value string) (*v1alpha1.IngressConfig, bool, error) {
switch name {
case "ingress-provider", "ingress-public-host", "ingress-xrpc-host", "ingress-relay-url",
"ingress-opentunnel-command", "ingress-opentunnel-route-name", "ingress-opentunnel-local-host", "ingress-opentunnel-proxy-protocol",
"requester-ingress-provider", "requester-ingress-webrtc-stun":
default:
return ingress, false, nil
}
if ingress == nil {
ingress = &v1alpha1.IngressConfig{}
}
switch name {
case "ingress-provider", "requester-ingress-provider":
ingress.Provider = value
case "requester-ingress-webrtc-stun":
if ingress.WebRTC == nil {
ingress.WebRTC = &v1alpha1.IngressWebRTCConfig{}
}
ingress.WebRTC.STUNURLs = splitList(value)
case "ingress-public-host":
ingress.PublicHost = value
case "ingress-xrpc-host":
if ingress.Xrpc == nil {
ingress.Xrpc = &v1alpha1.IngressXrpcConfig{}
}
ingress.Xrpc.IngressProxyHost = value
case "ingress-relay-url":
if ingress.Xrpc == nil {
ingress.Xrpc = &v1alpha1.IngressXrpcConfig{}
}
ingress.Xrpc.RelayURL = value
case "ingress-opentunnel-command", "ingress-opentunnel-route-name", "ingress-opentunnel-local-host", "ingress-opentunnel-proxy-protocol":
if ingress.OpenTunnel == nil {
ingress.OpenTunnel = &v1alpha1.IngressProxyOpenTunnel{}
}
switch name {
case "ingress-opentunnel-command":
ingress.OpenTunnel.Command = splitList(value)
case "ingress-opentunnel-route-name":
ingress.OpenTunnel.RouteName = value
case "ingress-opentunnel-local-host":
ingress.OpenTunnel.LocalHost = value
case "ingress-opentunnel-proxy-protocol":
ingress.OpenTunnel.ProxyProtocol = value
}
default:
return ingress, false, fmt.Errorf("--%s is not an ingress option", name)
}
return ingress, true, nil
}