diff --git a/go.mod b/go.mod index 80b3bc4a69c7619fbaf1808c757f12e2ec7ceb39..e45aa726db23590c7d48b32115f145a207993289 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( ) require ( - 0xacab.org/leap/bitmask-core v0.0.0-20240529192952-8ea2f4de269e + 0xacab.org/leap/bitmask-core v0.0.0-20240705122443-e372171b7c36 github.com/natefinch/npipe v0.0.0-20160621034901-c1b8fa8bdcce github.com/prometheus-community/pro-bing v0.4.0 github.com/rs/zerolog v1.33.0 diff --git a/go.sum b/go.sum index 5da2143c9cf2457123650ff7362f0a3e7b041e7b..a8380531c644ed24725c81a16d229e75a85c8056 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -0xacab.org/leap/bitmask-core v0.0.0-20240529192952-8ea2f4de269e h1:dg8K5g8gpWYh8GfJPJKlSF6twnjFa4Ui9FMEahAf3jw= -0xacab.org/leap/bitmask-core v0.0.0-20240529192952-8ea2f4de269e/go.mod h1:kuAy05ISfgrZJIPj2i7lXRxRlFF8gtRy3KvYYOgMYvI= +0xacab.org/leap/bitmask-core v0.0.0-20240705122443-e372171b7c36 h1:pX9BZDphco1wjiyyfJAy4cRb4fmKKn+6u5SMvhU01zI= +0xacab.org/leap/bitmask-core v0.0.0-20240705122443-e372171b7c36/go.mod h1:kuAy05ISfgrZJIPj2i7lXRxRlFF8gtRy3KvYYOgMYvI= 0xacab.org/leap/obfsvpn v1.0.1-0.20240625123757-59f234eea051 h1:z9sIIud8NbKW5+Qp0k6BnogK3O8CPWCN3Rx5Jbzq7bQ= 0xacab.org/leap/obfsvpn v1.0.1-0.20240625123757-59f234eea051/go.mod h1:uesfK5XkHYSgHRpE9/Bb2yKkKTE6VFViyjbU/z4ST60= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= diff --git a/pkg/vpn/menshen/backwards.go b/pkg/vpn/menshen/backwards.go index 231c74d186b0abc313c082118d9d10746289f026..f1f5e647d36c8e5fffdd18fe172c721771fa727d 100644 --- a/pkg/vpn/menshen/backwards.go +++ b/pkg/vpn/menshen/backwards.go @@ -24,7 +24,7 @@ func NewBonafideGateway(v5Gateway *models.ModelsGateway) *bonafide.Gateway { Location: v5Gateway.Location, LocationName: strings.Title(v5Gateway.Location), CountryCode: getCountryCodeForLocation(v5Gateway.Location), - Ports: []string{fmt.Sprintf("%d", v5Gateway.Ports[0])}, + Ports: []string{fmt.Sprintf("%d", v5Gateway.Port)}, Protocols: []string{v5Gateway.Type}, //Options: v5Gateway.Options, //Transport: v5Gateway.Transport, diff --git a/pkg/vpn/menshen/gateway.go b/pkg/vpn/menshen/gateway.go index 0f81228f968f5055e9296b273fe2c673cf529fe8..f9fe9bf8d310ef0e75bcc95c7fc7478e187984a9 100644 --- a/pkg/vpn/menshen/gateway.go +++ b/pkg/vpn/menshen/gateway.go @@ -119,7 +119,7 @@ func (m *Menshen) FetchAllGateways(transport string) error { for i, gw := range m.Gateways { log.Debug(). Str("host", gw.Host). - Int64("port", gw.Ports[0]). + Int64("port", gw.Port). Str("ip", gw.IPAddr). Str("location", strings.Title(gw.Location)). Str("protocol", gw.Transport). diff --git a/pkg/vpn/menshen/init.go b/pkg/vpn/menshen/init.go index 761772e194371deb95a7ababeaa53c4ef8d4bd24..62c8ff3f1a416edea56f2cbee908d3c5b88afae4 100644 --- a/pkg/vpn/menshen/init.go +++ b/pkg/vpn/menshen/init.go @@ -2,7 +2,6 @@ package menshen import ( "errors" - "fmt" "net/url" "os" "strconv" @@ -114,17 +113,11 @@ func (m *Menshen) GetOpenvpnArgs() ([]string, error) { return []string{}, err } - // openVpnArgsInterface is of type interface{} - openVpnArgsInterface := service.OpenvpnConfiguration - // openVpnArgsArrayInterface is of type map[string]interface{} // openVpnArgsArrayInterface["dev"] = "tun" (string) // openVpnArgsArrayInterface["persist-key"] = true (bool) - openVpnArgsArrayInterface, ok := openVpnArgsInterface.(map[string]interface{}) - if !ok { - return []string{}, - fmt.Errorf("OpenVPN arguments returned by menshen have an invalid type: %v", openVpnArgsInterface) - } + openVpnArgsArrayInterface := service.OpenvpnConfiguration + openVpnArgs := []string{} for arg, value := range openVpnArgsArrayInterface { // e.g.: arg=dev value=tun, arg=persist-key value=true diff --git a/vendor/0xacab.org/leap/bitmask-core/models/models_bridge.go b/vendor/0xacab.org/leap/bitmask-core/models/models_bridge.go index 6c00bac35ec504a1bddcc38f00e04668bff9c4a3..486692bb872179b88987714ce6d5d91217584d55 100644 --- a/vendor/0xacab.org/leap/bitmask-core/models/models_bridge.go +++ b/vendor/0xacab.org/leap/bitmask-core/models/models_bridge.go @@ -21,6 +21,10 @@ type ModelsBridge struct { // otherwise. Auth string `json:"auth,omitempty"` + // Bucket is a "bucket" tag that connotes a resource group that a user may or may not + // have access to. An empty bucket string implies that it is open access + Bucket string `json:"bucket,omitempty"` + // An experimental bridge flags any bridge that, for whatever reason, // is not deemed stable. The expectation is that clients have to opt-in to // experimental bridges (and gateways too). @@ -47,7 +51,7 @@ type ModelsBridge struct { // Options contain the map of options that will be passed to the client. It usually // contains authentication credentials. - Options interface{} `json:"options,omitempty"` + Options map[string]interface{} `json:"options,omitempty"` // Overloaded should be set to true if the fractional load is above threshold. Overloaded bool `json:"overloaded,omitempty"` diff --git a/vendor/0xacab.org/leap/bitmask-core/models/models_e_ip_service.go b/vendor/0xacab.org/leap/bitmask-core/models/models_e_ip_service.go index 98709bf0221762606329f9f61e5cb27ba3fcf7ad..17ad391e5d6a1e1c792fa306d3b786f60f3d8e67 100644 --- a/vendor/0xacab.org/leap/bitmask-core/models/models_e_ip_service.go +++ b/vendor/0xacab.org/leap/bitmask-core/models/models_e_ip_service.go @@ -24,7 +24,7 @@ type ModelsEIPService struct { Locations interface{} `json:"locations,omitempty"` // openvpn configuration - OpenvpnConfiguration interface{} `json:"openvpn_configuration,omitempty"` + OpenvpnConfiguration map[string]interface{} `json:"openvpn_configuration,omitempty"` // serial Serial int64 `json:"serial,omitempty"` diff --git a/vendor/0xacab.org/leap/bitmask-core/models/models_gateway.go b/vendor/0xacab.org/leap/bitmask-core/models/models_gateway.go index ce5d2bc353bba84ad518452a0b86862191401473..b7015c16842715fc246109ab42e27f595a24b59c 100644 --- a/vendor/0xacab.org/leap/bitmask-core/models/models_gateway.go +++ b/vendor/0xacab.org/leap/bitmask-core/models/models_gateway.go @@ -17,6 +17,10 @@ import ( // swagger:model models.Gateway type ModelsGateway struct { + // Bucket is a "bucket" tag that connotes a resource group that a user may or may not + // have access to. An empty bucket string implies that it is open access + Bucket string `json:"bucket,omitempty"` + // An experimental gateway flags any gateway that, for whatever reason, // is not deemed stable. The expectation is that clients have to opt-in to // experimental gateways (and bridges too). @@ -49,10 +53,8 @@ type ModelsGateway struct { // Overloaded should be set to true if the fractional load is above threshold. Overloaded bool `json:"overloaded,omitempty"` - // 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 []int64 `json:"ports"` + // The (primary) port this gateway is listening on. + Port int64 `json:"port,omitempty"` // TCP, UDP or KCP. This was called "protocol" in previous versions of the API. Transport string `json:"transport,omitempty"` diff --git a/vendor/0xacab.org/leap/bitmask-core/pkg/bootstrap/init.go b/vendor/0xacab.org/leap/bitmask-core/pkg/bootstrap/init.go index 2900fb08181f10411139d8dfef98e1b49b4310d4..48592803fcc0f8e6876badb219bf10bc22db70ba 100644 --- a/vendor/0xacab.org/leap/bitmask-core/pkg/bootstrap/init.go +++ b/vendor/0xacab.org/leap/bitmask-core/pkg/bootstrap/init.go @@ -334,7 +334,7 @@ func (api *API) SerializeConfig(params *GatewayParams) (string, error) { Cert: crt, Key: key, IPAddr: gw.IPAddr, - Port: fmt.Sprintf("%d", gw.Ports[0]), + Port: fmt.Sprintf("%d", gw.Port), Transport: gw.Transport + "4", } tmpl, err := template.New("openvpncert").Parse(openvpnConfigTemplate) diff --git a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_bridge_location_responses.go b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_bridge_location_responses.go index 36c358066f822b48d5927fc5c130cb6c0687d0d5..3a40bfe21097b6e5c13a985b0f7156552777fac6 100644 --- a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_bridge_location_responses.go +++ b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_bridge_location_responses.go @@ -6,6 +6,7 @@ package provisioning // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -97,11 +98,13 @@ func (o *Get5BridgeLocationOK) Code() int { } func (o *Get5BridgeLocationOK) Error() string { - return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationOK %s", 200, payload) } func (o *Get5BridgeLocationOK) String() string { - return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationOK %s", 200, payload) } func (o *Get5BridgeLocationOK) GetPayload() []*models.ModelsBridge { @@ -163,11 +166,13 @@ func (o *Get5BridgeLocationBadRequest) Code() int { } func (o *Get5BridgeLocationBadRequest) Error() string { - return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationBadRequest %s", 400, payload) } func (o *Get5BridgeLocationBadRequest) String() string { - return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationBadRequest %s", 400, payload) } func (o *Get5BridgeLocationBadRequest) GetPayload() interface{} { @@ -229,11 +234,13 @@ func (o *Get5BridgeLocationNotFound) Code() int { } func (o *Get5BridgeLocationNotFound) Error() string { - return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationNotFound %s", 404, payload) } func (o *Get5BridgeLocationNotFound) String() string { - return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationNotFound %s", 404, payload) } func (o *Get5BridgeLocationNotFound) GetPayload() interface{} { @@ -295,11 +302,13 @@ func (o *Get5BridgeLocationInternalServerError) Code() int { } func (o *Get5BridgeLocationInternalServerError) Error() string { - return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationInternalServerError %s", 500, payload) } func (o *Get5BridgeLocationInternalServerError) String() string { - return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridge/{location}][%d] get5BridgeLocationInternalServerError %s", 500, payload) } func (o *Get5BridgeLocationInternalServerError) GetPayload() interface{} { diff --git a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_bridges_responses.go b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_bridges_responses.go index 149893f91196a56cb12d2442341b021f9a4639f8..5820ed853b5a73b6ddd18f643f850b4cd385cb50 100644 --- a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_bridges_responses.go +++ b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_bridges_responses.go @@ -6,6 +6,7 @@ package provisioning // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -97,11 +98,13 @@ func (o *Get5BridgesOK) Code() int { } func (o *Get5BridgesOK) Error() string { - return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesOK %s", 200, payload) } func (o *Get5BridgesOK) String() string { - return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesOK %s", 200, payload) } func (o *Get5BridgesOK) GetPayload() []*models.ModelsBridge { @@ -163,11 +166,13 @@ func (o *Get5BridgesBadRequest) Code() int { } func (o *Get5BridgesBadRequest) Error() string { - return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesBadRequest %s", 400, payload) } func (o *Get5BridgesBadRequest) String() string { - return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesBadRequest %s", 400, payload) } func (o *Get5BridgesBadRequest) GetPayload() interface{} { @@ -229,11 +234,13 @@ func (o *Get5BridgesNotFound) Code() int { } func (o *Get5BridgesNotFound) Error() string { - return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesNotFound %s", 404, payload) } func (o *Get5BridgesNotFound) String() string { - return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesNotFound %s", 404, payload) } func (o *Get5BridgesNotFound) GetPayload() interface{} { @@ -295,11 +302,13 @@ func (o *Get5BridgesInternalServerError) Code() int { } func (o *Get5BridgesInternalServerError) Error() string { - return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesInternalServerError %s", 500, payload) } func (o *Get5BridgesInternalServerError) String() string { - return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/bridges][%d] get5BridgesInternalServerError %s", 500, payload) } func (o *Get5BridgesInternalServerError) GetPayload() interface{} { diff --git a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_gateway_location_responses.go b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_gateway_location_responses.go index 28f1cf16c866b2293ade9db037edf7bf059250f7..fa23e465a459b95cc90848e36e2fac12961bf7fa 100644 --- a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_gateway_location_responses.go +++ b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_gateway_location_responses.go @@ -6,6 +6,7 @@ package provisioning // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -97,11 +98,13 @@ func (o *Get5GatewayLocationOK) Code() int { } func (o *Get5GatewayLocationOK) Error() string { - return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationOK %s", 200, payload) } func (o *Get5GatewayLocationOK) String() string { - return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationOK %s", 200, payload) } func (o *Get5GatewayLocationOK) GetPayload() []*models.ModelsGateway { @@ -163,11 +166,13 @@ func (o *Get5GatewayLocationBadRequest) Code() int { } func (o *Get5GatewayLocationBadRequest) Error() string { - return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationBadRequest %s", 400, payload) } func (o *Get5GatewayLocationBadRequest) String() string { - return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationBadRequest %s", 400, payload) } func (o *Get5GatewayLocationBadRequest) GetPayload() interface{} { @@ -229,11 +234,13 @@ func (o *Get5GatewayLocationNotFound) Code() int { } func (o *Get5GatewayLocationNotFound) Error() string { - return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationNotFound %s", 404, payload) } func (o *Get5GatewayLocationNotFound) String() string { - return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationNotFound %s", 404, payload) } func (o *Get5GatewayLocationNotFound) GetPayload() interface{} { @@ -295,11 +302,13 @@ func (o *Get5GatewayLocationInternalServerError) Code() int { } func (o *Get5GatewayLocationInternalServerError) Error() string { - return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationInternalServerError %s", 500, payload) } func (o *Get5GatewayLocationInternalServerError) String() string { - return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateway/{location}][%d] get5GatewayLocationInternalServerError %s", 500, payload) } func (o *Get5GatewayLocationInternalServerError) GetPayload() interface{} { diff --git a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_gateways_responses.go b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_gateways_responses.go index 76e6c4fa9e1db82965078aca61e772cc22c3ba3f..43aa09708fc264be9a10dd93a236f66287d3a050 100644 --- a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_gateways_responses.go +++ b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_gateways_responses.go @@ -6,6 +6,7 @@ package provisioning // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -97,11 +98,13 @@ func (o *Get5GatewaysOK) Code() int { } func (o *Get5GatewaysOK) Error() string { - return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysOK %s", 200, payload) } func (o *Get5GatewaysOK) String() string { - return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysOK %s", 200, payload) } func (o *Get5GatewaysOK) GetPayload() []*models.ModelsGateway { @@ -163,11 +166,13 @@ func (o *Get5GatewaysBadRequest) Code() int { } func (o *Get5GatewaysBadRequest) Error() string { - return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysBadRequest %s", 400, payload) } func (o *Get5GatewaysBadRequest) String() string { - return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysBadRequest %s", 400, payload) } func (o *Get5GatewaysBadRequest) GetPayload() interface{} { @@ -229,11 +234,13 @@ func (o *Get5GatewaysNotFound) Code() int { } func (o *Get5GatewaysNotFound) Error() string { - return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysNotFound %s", 404, payload) } func (o *Get5GatewaysNotFound) String() string { - return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysNotFound %s", 404, payload) } func (o *Get5GatewaysNotFound) GetPayload() interface{} { @@ -295,11 +302,13 @@ func (o *Get5GatewaysInternalServerError) Code() int { } func (o *Get5GatewaysInternalServerError) Error() string { - return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysInternalServerError %s", 500, payload) } func (o *Get5GatewaysInternalServerError) String() string { - return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/gateways][%d] get5GatewaysInternalServerError %s", 500, payload) } func (o *Get5GatewaysInternalServerError) GetPayload() interface{} { diff --git a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_openvpn_cert_responses.go b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_openvpn_cert_responses.go index cf7b1d43eb9cb0cd529e86041f444110f3a13c58..fff8ad0901e41adbf1c3a8d64769cd53aee422ae 100644 --- a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_openvpn_cert_responses.go +++ b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_openvpn_cert_responses.go @@ -6,6 +6,7 @@ package provisioning // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -95,11 +96,13 @@ func (o *Get5OpenvpnCertOK) Code() int { } func (o *Get5OpenvpnCertOK) Error() string { - return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertOK %s", 200, payload) } func (o *Get5OpenvpnCertOK) String() string { - return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertOK %s", 200, payload) } func (o *Get5OpenvpnCertOK) GetPayload() string { @@ -161,11 +164,13 @@ func (o *Get5OpenvpnCertBadRequest) Code() int { } func (o *Get5OpenvpnCertBadRequest) Error() string { - return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertBadRequest %s", 400, payload) } func (o *Get5OpenvpnCertBadRequest) String() string { - return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertBadRequest %s", 400, payload) } func (o *Get5OpenvpnCertBadRequest) GetPayload() interface{} { @@ -227,11 +232,13 @@ func (o *Get5OpenvpnCertNotFound) Code() int { } func (o *Get5OpenvpnCertNotFound) Error() string { - return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertNotFound %s", 404, payload) } func (o *Get5OpenvpnCertNotFound) String() string { - return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertNotFound %s", 404, payload) } func (o *Get5OpenvpnCertNotFound) GetPayload() interface{} { @@ -293,11 +300,13 @@ func (o *Get5OpenvpnCertInternalServerError) Code() int { } func (o *Get5OpenvpnCertInternalServerError) Error() string { - return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertInternalServerError %s", 500, payload) } func (o *Get5OpenvpnCertInternalServerError) String() string { - return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/cert][%d] get5OpenvpnCertInternalServerError %s", 500, payload) } func (o *Get5OpenvpnCertInternalServerError) GetPayload() interface{} { diff --git a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_openvpn_config_responses.go b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_openvpn_config_responses.go index 4bba50e121347ba28a4db51bff3ce5472dc48af0..0e7975a1047c91c82dcf8ebb8770cb4f05fffe60 100644 --- a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_openvpn_config_responses.go +++ b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_openvpn_config_responses.go @@ -6,6 +6,7 @@ package provisioning // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -95,11 +96,13 @@ func (o *Get5OpenvpnConfigOK) Code() int { } func (o *Get5OpenvpnConfigOK) Error() string { - return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigOK %s", 200, payload) } func (o *Get5OpenvpnConfigOK) String() string { - return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigOK %s", 200, payload) } func (o *Get5OpenvpnConfigOK) GetPayload() string { @@ -161,11 +164,13 @@ func (o *Get5OpenvpnConfigBadRequest) Code() int { } func (o *Get5OpenvpnConfigBadRequest) Error() string { - return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigBadRequest %s", 400, payload) } func (o *Get5OpenvpnConfigBadRequest) String() string { - return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigBadRequest %s", 400, payload) } func (o *Get5OpenvpnConfigBadRequest) GetPayload() interface{} { @@ -227,11 +232,13 @@ func (o *Get5OpenvpnConfigNotFound) Code() int { } func (o *Get5OpenvpnConfigNotFound) Error() string { - return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigNotFound %s", 404, payload) } func (o *Get5OpenvpnConfigNotFound) String() string { - return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigNotFound %s", 404, payload) } func (o *Get5OpenvpnConfigNotFound) GetPayload() interface{} { @@ -293,11 +300,13 @@ func (o *Get5OpenvpnConfigInternalServerError) Code() int { } func (o *Get5OpenvpnConfigInternalServerError) Error() string { - return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigInternalServerError %s", 500, payload) } func (o *Get5OpenvpnConfigInternalServerError) String() string { - return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/openvpn/config][%d] get5OpenvpnConfigInternalServerError %s", 500, payload) } func (o *Get5OpenvpnConfigInternalServerError) GetPayload() interface{} { diff --git a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_service_responses.go b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_service_responses.go index d6dbed79241f32c20d526a0db6be1f8bd6592dac..e0f4acc08bd2a4bad88a596fddab84495bc2a717 100644 --- a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_service_responses.go +++ b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get5_service_responses.go @@ -6,6 +6,7 @@ package provisioning // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -97,11 +98,13 @@ func (o *Get5ServiceOK) Code() int { } func (o *Get5ServiceOK) Error() string { - return fmt.Sprintf("[GET /5/service][%d] get5ServiceOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/service][%d] get5ServiceOK %s", 200, payload) } func (o *Get5ServiceOK) String() string { - return fmt.Sprintf("[GET /5/service][%d] get5ServiceOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/service][%d] get5ServiceOK %s", 200, payload) } func (o *Get5ServiceOK) GetPayload() *models.ModelsEIPService { @@ -165,11 +168,13 @@ func (o *Get5ServiceBadRequest) Code() int { } func (o *Get5ServiceBadRequest) Error() string { - return fmt.Sprintf("[GET /5/service][%d] get5ServiceBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/service][%d] get5ServiceBadRequest %s", 400, payload) } func (o *Get5ServiceBadRequest) String() string { - return fmt.Sprintf("[GET /5/service][%d] get5ServiceBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/service][%d] get5ServiceBadRequest %s", 400, payload) } func (o *Get5ServiceBadRequest) GetPayload() interface{} { @@ -231,11 +236,13 @@ func (o *Get5ServiceNotFound) Code() int { } func (o *Get5ServiceNotFound) Error() string { - return fmt.Sprintf("[GET /5/service][%d] get5ServiceNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/service][%d] get5ServiceNotFound %s", 404, payload) } func (o *Get5ServiceNotFound) String() string { - return fmt.Sprintf("[GET /5/service][%d] get5ServiceNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/service][%d] get5ServiceNotFound %s", 404, payload) } func (o *Get5ServiceNotFound) GetPayload() interface{} { @@ -297,11 +304,13 @@ func (o *Get5ServiceInternalServerError) Code() int { } func (o *Get5ServiceInternalServerError) Error() string { - return fmt.Sprintf("[GET /5/service][%d] get5ServiceInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/service][%d] get5ServiceInternalServerError %s", 500, payload) } func (o *Get5ServiceInternalServerError) String() string { - return fmt.Sprintf("[GET /5/service][%d] get5ServiceInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /5/service][%d] get5ServiceInternalServerError %s", 500, payload) } func (o *Get5ServiceInternalServerError) GetPayload() interface{} { diff --git a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get_autoconf_responses.go b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get_autoconf_responses.go index 1dcfa22263bcc7dcc5332d8176cc3e2d5ffd5f10..8618a1af30e5b9194e7dad26cd5cc48abb092014 100644 --- a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get_autoconf_responses.go +++ b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/get_autoconf_responses.go @@ -6,6 +6,7 @@ package provisioning // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" "fmt" "io" @@ -95,11 +96,13 @@ func (o *GetAutoconfOK) Code() int { } func (o *GetAutoconfOK) Error() string { - return fmt.Sprintf("[GET /autoconf][%d] getAutoconfOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /autoconf][%d] getAutoconfOK %s", 200, payload) } func (o *GetAutoconfOK) String() string { - return fmt.Sprintf("[GET /autoconf][%d] getAutoconfOK %+v", 200, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /autoconf][%d] getAutoconfOK %s", 200, payload) } func (o *GetAutoconfOK) GetPayload() string { @@ -161,11 +164,13 @@ func (o *GetAutoconfBadRequest) Code() int { } func (o *GetAutoconfBadRequest) Error() string { - return fmt.Sprintf("[GET /autoconf][%d] getAutoconfBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /autoconf][%d] getAutoconfBadRequest %s", 400, payload) } func (o *GetAutoconfBadRequest) String() string { - return fmt.Sprintf("[GET /autoconf][%d] getAutoconfBadRequest %+v", 400, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /autoconf][%d] getAutoconfBadRequest %s", 400, payload) } func (o *GetAutoconfBadRequest) GetPayload() interface{} { @@ -227,11 +232,13 @@ func (o *GetAutoconfNotFound) Code() int { } func (o *GetAutoconfNotFound) Error() string { - return fmt.Sprintf("[GET /autoconf][%d] getAutoconfNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /autoconf][%d] getAutoconfNotFound %s", 404, payload) } func (o *GetAutoconfNotFound) String() string { - return fmt.Sprintf("[GET /autoconf][%d] getAutoconfNotFound %+v", 404, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /autoconf][%d] getAutoconfNotFound %s", 404, payload) } func (o *GetAutoconfNotFound) GetPayload() interface{} { @@ -293,11 +300,13 @@ func (o *GetAutoconfInternalServerError) Code() int { } func (o *GetAutoconfInternalServerError) Error() string { - return fmt.Sprintf("[GET /autoconf][%d] getAutoconfInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /autoconf][%d] getAutoconfInternalServerError %s", 500, payload) } func (o *GetAutoconfInternalServerError) String() string { - return fmt.Sprintf("[GET /autoconf][%d] getAutoconfInternalServerError %+v", 500, o.Payload) + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /autoconf][%d] getAutoconfInternalServerError %s", 500, payload) } func (o *GetAutoconfInternalServerError) GetPayload() interface{} { diff --git a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/provisioning_client.go b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/provisioning_client.go index 64bafc348c42f2cd8dc6651edc8d0130b4c63fad..d93cb17d2e2b17169a0a59e16209c6d730c7079b 100644 --- a/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/provisioning_client.go +++ b/vendor/0xacab.org/leap/bitmask-core/pkg/client/provisioning/provisioning_client.go @@ -9,6 +9,7 @@ import ( "fmt" "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" ) @@ -17,6 +18,31 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientServi return &Client{transport: transport, formats: formats} } +// New creates a new provisioning API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new provisioning API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + /* Client for provisioning API */ @@ -25,9 +51,33 @@ type Client struct { formats strfmt.Registry } -// ClientOption is the option for Client methods +// ClientOption may be used to customize the behavior of Client methods. type ClientOption func(*runtime.ClientOperation) +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithAccept allows the client to force the Accept header +// to negotiate a specific Producer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithAccept(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{mime} + } +} + +// WithAcceptApplicationJSON sets the Accept header to "application/json". +func WithAcceptApplicationJSON(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/json"} +} + +// WithAcceptTextPlain sets the Accept header to "text/plain". +func WithAcceptTextPlain(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"text/plain"} +} + // ClientService is the interface for Client methods type ClientService interface { Get5BridgeLocation(params *Get5BridgeLocationParams, opts ...ClientOption) (*Get5BridgeLocationOK, error) @@ -210,9 +260,9 @@ func (a *Client) Get5Gateways(params *Get5GatewaysParams, opts ...ClientOption) } /* -Get5OpenvpnCert fetches open v p n certificate +Get5OpenvpnCert gets openvpn cert -fetch a working certificate for OpenVPN service. +Fetch a new key and cert. */ func (a *Client) Get5OpenvpnCert(params *Get5OpenvpnCertParams, opts ...ClientOption) (*Get5OpenvpnCertOK, error) { // TODO: Validate the params before sending @@ -223,7 +273,7 @@ func (a *Client) Get5OpenvpnCert(params *Get5OpenvpnCertParams, opts ...ClientOp ID: "Get5OpenvpnCert", Method: "GET", PathPattern: "/5/openvpn/cert", - ProducesMediaTypes: []string{"text/plain"}, + ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, diff --git a/vendor/modules.txt b/vendor/modules.txt index 87511d8cf0b600a61152e220bd6996ea8d52496f..4666698e52b561bc084038565501a416be585a3d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# 0xacab.org/leap/bitmask-core v0.0.0-20240529192952-8ea2f4de269e +# 0xacab.org/leap/bitmask-core v0.0.0-20240705122443-e372171b7c36 ## explicit; go 1.20 0xacab.org/leap/bitmask-core/models 0xacab.org/leap/bitmask-core/pkg/bootstrap