diff options
Diffstat (limited to 'internal/api')
| -rw-r--r-- | internal/api/api.go | 5 | ||||
| -rw-r--r-- | internal/api/api_test.go | 20 |
2 files changed, 2 insertions, 23 deletions
diff --git a/internal/api/api.go b/internal/api/api.go index 7111c45..4ee82b0 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -233,8 +233,6 @@ type ConnectData struct { Protocol protocol.Protocol // Expires tells us when this configuration expires Expires time.Time - // Proxy is filled when WireGuard is proxied - Proxy *wireguard.Proxy } // see https://github.com/eduvpn/documentation/blob/v3/API.md#request-1 @@ -338,7 +336,7 @@ func (a *API) Connect(ctx context.Context, prof profiles.Profile, protos []proto }, nil } - vpnCfg, proxy, err := wireguard.Config(vpnCfg, wgKey, proto == protocol.WireGuardProxy) + vpnCfg, err = wireguard.Config(vpnCfg, wgKey) if err != nil { return nil, err } @@ -346,7 +344,6 @@ func (a *API) Connect(ctx context.Context, prof profiles.Profile, protos []proto Configuration: vpnCfg, Protocol: proto, Expires: expT, - Proxy: proxy, }, nil } diff --git a/internal/api/api_test.go b/internal/api/api_test.go index f611f07..6ad70f6 100644 --- a/internal/api/api_test.go +++ b/internal/api/api_test.go @@ -10,6 +10,7 @@ import ( "net/url" "reflect" "regexp" + "slices" "strings" "testing" "time" @@ -17,11 +18,9 @@ import ( "codeberg.org/eduVPN/eduvpn-common/internal/api/profiles" httpw "codeberg.org/eduVPN/eduvpn-common/internal/http" "codeberg.org/eduVPN/eduvpn-common/internal/test" - "codeberg.org/eduVPN/eduvpn-common/internal/wireguard" "codeberg.org/eduVPN/eduvpn-common/types/protocol" "codeberg.org/eduVPN/eduvpn-common/types/server" "github.com/jwijenbergh/eduoauth-go" - "slices" ) func tokenHandler(t *testing.T, gt []string) func(http.ResponseWriter, *http.Request) { @@ -421,7 +420,6 @@ func TestAPIConnect(t *testing.T) { Configuration: "openvpnconfig\nscript-security 0", Protocol: protocol.OpenVPN, Expires: time.Date(2000, time.January, 0, 0, 0, 0, 0, time.UTC), - Proxy: nil, }, protos: []protocol.Protocol{protocol.OpenVPN, protocol.WireGuard}, err: nil, @@ -437,7 +435,6 @@ func TestAPIConnect(t *testing.T) { PrivateKey = .*`, Protocol: protocol.WireGuard, Expires: time.Date(2000, time.January, 0, 0, 0, 0, 0, time.UTC), - Proxy: nil, }, protos: []protocol.Protocol{protocol.OpenVPN, protocol.WireGuard}, err: nil, @@ -453,8 +450,6 @@ PrivateKey = .*`, PrivateKey = .*`, Protocol: protocol.WireGuardProxy, Expires: time.Date(2000, time.January, 0, 0, 0, 0, 0, time.UTC), - // proxy will be manually checked - Proxy: &wireguard.Proxy{}, }, ptcp: true, protos: []protocol.Protocol{protocol.OpenVPN, protocol.WireGuard}, @@ -490,19 +485,6 @@ PrivateKey = .*`, // we have already checked the config using a regex c.cd.Configuration = gcd.Configuration - // check proxy manually - if c.cd.Proxy != nil && gcd.Proxy != nil { - if gcd.Proxy.Peer != "https://proxyendpoint" { - t.Fatalf("config data proxy peer is no proxyendpoint with HTTPS scheme: %s", gcd.Proxy.Peer) - } - if gcd.Proxy.SourcePort <= 0 { - t.Fatalf("got proxy source port is smaller or equal to 0: %v", gcd.Proxy.SourcePort) - } - if gcd.Proxy.ListenPort <= 0 { - t.Fatalf("proxy listen port is smaller or equal to 0: %v", gcd.Proxy.ListenPort) - } - c.cd.Proxy = gcd.Proxy - } } if !reflect.DeepEqual(gcd, c.cd) { t.Fatalf("got connect data: %v, not equal to want: %v", gcd, c.cd) |
