Compare commits
4 Commits
v1.1.2
...
c8a34ee760
| Author | SHA1 | Date | |
|---|---|---|---|
|
c8a34ee760
|
|||
|
a0b742b0b1
|
|||
|
d4bd0ef1ca
|
|||
|
95e47c708c
|
2
.cargo/config.toml
Normal file
2
.cargo/config.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
[env]
|
||||
RUSTC_BOOTSTRAP = "1"
|
||||
@@ -79,11 +79,11 @@ jobs:
|
||||
|
||||
- name: Push manifests
|
||||
run: |
|
||||
flux push artifact oci://$OCI_REPO/manifests:${{ gitea.head_ref || gitea.ref_name }} \
|
||||
flux push artifact oci://${{ env.OCI_REPO }}/manifests:${{ gitea.head_ref || gitea.ref_name }} \
|
||||
--path="./manifests.yaml" \
|
||||
--source="$(git config --get remote.origin.url)" \
|
||||
--revision="$(git rev-parse HEAD)" \
|
||||
$(echo "${{ steps.meta.outputs.labels }}" | sed -e 's/^/-a /')
|
||||
|
||||
flux tag artifact oci://$OCI_REPO/manifests:${{ gitea.head_ref || gitea.ref_name }} \
|
||||
flux tag artifact oci://${{ env.OCI_REPO }}/manifests:${{ gitea.head_ref || gitea.ref_name }} \
|
||||
$(echo "${{ steps.meta.outputs.tags }}" | sed -e 's/^.*:/--tag /')
|
||||
|
||||
@@ -16,8 +16,6 @@ RUN cargo chef cook --release --recipe-path recipe.json
|
||||
COPY . .
|
||||
ARG RELEASE_VERSION
|
||||
ENV RELEASE_VERSION=${RELEASE_VERSION}
|
||||
# HACK: Enable the use of features on stable
|
||||
ENV RUSTC_BOOTSTRAP=1
|
||||
RUN cargo auditable build --release
|
||||
|
||||
FROM gcr.io/distroless/cc-debian12:nonroot AS runtime
|
||||
|
||||
4
rust-toolchain.toml
Normal file
4
rust-toolchain.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[toolchain]
|
||||
channel = "1.85"
|
||||
profile = "default"
|
||||
components = ["rust-analyzer"]
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
|
||||
use std::task::{Context, Poll};
|
||||
|
||||
use pin_project_lite::pin_project;
|
||||
@@ -14,25 +14,34 @@ pub struct Stats {
|
||||
connections: AtomicUsize,
|
||||
rx: AtomicUsize,
|
||||
tx: AtomicUsize,
|
||||
failed: AtomicBool,
|
||||
}
|
||||
|
||||
impl Stats {
|
||||
pub fn add_connection(&self) {
|
||||
self.connections.fetch_add(1, Ordering::Relaxed);
|
||||
self.connections.store(1, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
pub fn add_rx_bytes(&self, n: usize) {
|
||||
self.rx.fetch_add(n, Ordering::Relaxed);
|
||||
self.rx.store(n, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
pub fn add_tx_bytes(&self, n: usize) {
|
||||
self.tx.fetch_add(n, Ordering::Relaxed);
|
||||
self.tx.store(n, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
pub fn connections(&self) -> usize {
|
||||
self.connections.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
pub fn failed(&self) -> bool {
|
||||
self.failed.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
pub fn set_failed(&self, failed: bool) {
|
||||
self.failed.store(failed, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
pub fn rx(&self) -> Unit {
|
||||
Unit::new(self.rx.load(Ordering::Relaxed), "B")
|
||||
}
|
||||
|
||||
@@ -40,7 +40,12 @@ impl TunnelInner {
|
||||
&self.internal_address,
|
||||
self.port,
|
||||
)
|
||||
.await?;
|
||||
.await
|
||||
.inspect_err(|_| {
|
||||
self.stats.set_failed(true);
|
||||
})?;
|
||||
|
||||
self.stats.set_failed(false);
|
||||
|
||||
Ok(TrackStats::new(channel.into_stream(), self.stats.clone()))
|
||||
}
|
||||
|
||||
@@ -17,9 +17,15 @@ pub struct TunnelRow {
|
||||
|
||||
impl From<&TunnelRow> for Vec<Span<'static>> {
|
||||
fn from(row: &TunnelRow) -> Self {
|
||||
let port = if row.stats.failed() {
|
||||
row.port.clone().red()
|
||||
} else {
|
||||
row.port.clone()
|
||||
};
|
||||
|
||||
vec![
|
||||
row.name.clone(),
|
||||
row.port.clone(),
|
||||
port,
|
||||
row.access.clone(),
|
||||
row.address.clone(),
|
||||
row.stats.connections().to_string().into(),
|
||||
|
||||
Reference in New Issue
Block a user