mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
Handle portal endpoint network error
This commit is contained in:
parent
187ca778f2
commit
79e0f0c7c1
8
.github/workflows/build.yaml
vendored
8
.github/workflows/build.yaml
vendored
@ -9,6 +9,9 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- dev
|
- dev
|
||||||
|
- hotfix/*
|
||||||
|
- feature/*
|
||||||
|
- release/*
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
- v*.*.*
|
- v*.*.*
|
||||||
@ -42,6 +45,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_PAT }}
|
token: ${{ secrets.GH_PAT }}
|
||||||
repository: yuezk/GlobalProtect-openconnect
|
repository: yuezk/GlobalProtect-openconnect
|
||||||
|
ref: ${{ github.ref }}
|
||||||
path: source/gp
|
path: source/gp
|
||||||
- name: Create tarball
|
- name: Create tarball
|
||||||
run: |
|
run: |
|
||||||
@ -95,12 +99,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_PAT }}
|
token: ${{ secrets.GH_PAT }}
|
||||||
repository: yuezk/GlobalProtect-openconnect
|
repository: yuezk/GlobalProtect-openconnect
|
||||||
|
ref: ${{ github.ref }}
|
||||||
path: gpgui-source/gp
|
path: gpgui-source/gp
|
||||||
- name: Checkout gpgui
|
- name: Checkout gpgui@${{ github.ref_name }}
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_PAT }}
|
token: ${{ secrets.GH_PAT }}
|
||||||
repository: yuezk/gpgui
|
repository: yuezk/gpgui
|
||||||
|
ref: ${{ github.ref_name }}
|
||||||
path: gpgui-source/gpgui
|
path: gpgui-source/gpgui
|
||||||
- name: Tarball
|
- name: Tarball
|
||||||
run: |
|
run: |
|
||||||
|
@ -153,7 +153,7 @@ impl<'a> ConnectHandler<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn connect_gateway_with_prelogin(&self, gateway: &str) -> anyhow::Result<()> {
|
async fn connect_gateway_with_prelogin(&self, gateway: &str) -> anyhow::Result<()> {
|
||||||
info!("Treat the portal as the gateway, connecting...");
|
info!("Performing the gateway authentication...");
|
||||||
|
|
||||||
let mut gp_params = self.build_gp_params();
|
let mut gp_params = self.build_gp_params();
|
||||||
gp_params.set_is_gateway(true);
|
gp_params.set_is_gateway(true);
|
||||||
|
@ -6,6 +6,6 @@ pub enum PortalError {
|
|||||||
PreloginError(String),
|
PreloginError(String),
|
||||||
#[error("Portal config error: {0}")]
|
#[error("Portal config error: {0}")]
|
||||||
ConfigError(String),
|
ConfigError(String),
|
||||||
#[error("Gateway error: {0}")]
|
#[error("Network error: {0}")]
|
||||||
GatewayError(String),
|
NetworkError(String),
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ pub async fn gateway_login(gateway: &str, cred: &Credential, gp_params: &GpParam
|
|||||||
.form(¶ms)
|
.form(¶ms)
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.map_err(|e| anyhow::anyhow!(PortalError::GatewayError(e.to_string())))?;
|
.map_err(|e| anyhow::anyhow!(PortalError::NetworkError(e.to_string())))?;
|
||||||
|
|
||||||
let status = res.status();
|
let status = res.status();
|
||||||
|
|
||||||
|
@ -102,7 +102,12 @@ pub async fn retrieve_config(portal: &str, cred: &Credential, gp_params: &GpPara
|
|||||||
|
|
||||||
info!("Portal config, user_agent: {}", gp_params.user_agent());
|
info!("Portal config, user_agent: {}", gp_params.user_agent());
|
||||||
|
|
||||||
let res = client.post(&url).form(¶ms).send().await?;
|
let res = client
|
||||||
|
.post(&url)
|
||||||
|
.form(¶ms)
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.map_err(|e| anyhow::anyhow!(PortalError::NetworkError(e.to_string())))?;
|
||||||
let status = res.status();
|
let status = res.status();
|
||||||
|
|
||||||
if status == StatusCode::NOT_FOUND {
|
if status == StatusCode::NOT_FOUND {
|
||||||
|
@ -118,7 +118,12 @@ pub async fn prelogin(portal: &str, gp_params: &GpParams) -> anyhow::Result<Prel
|
|||||||
.user_agent(user_agent)
|
.user_agent(user_agent)
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
let res = client.post(&prelogin_url).form(¶ms).send().await?;
|
let res = client
|
||||||
|
.post(&prelogin_url)
|
||||||
|
.form(¶ms)
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.map_err(|e| anyhow::anyhow!(PortalError::NetworkError(e.to_string())))?;
|
||||||
let status = res.status();
|
let status = res.status();
|
||||||
|
|
||||||
if status == StatusCode::NOT_FOUND {
|
if status == StatusCode::NOT_FOUND {
|
||||||
|
Loading…
Reference in New Issue
Block a user