Compare commits
No commits in common. "9e8fa4d0a6f4d473f2fbf69d0dd3515f679d8733" and "2d1c8a4cebdfbee19eca19c0d1dc1e16078e2d71" have entirely different histories.
9e8fa4d0a6
...
2d1c8a4ceb
5 changed files with 31 additions and 87 deletions
15
.github/workflows/release.yaml
vendored
15
.github/workflows/release.yaml
vendored
|
|
@ -44,45 +44,36 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
build: ['linux', 'debian', 'macos', 'arm-macos', 'windows']
|
build: ['linux', 'macos', 'arm-macos', 'windows']
|
||||||
include:
|
include:
|
||||||
- build: linux
|
- build: linux
|
||||||
os: ubuntu-22.04
|
os: ubuntu-22.04
|
||||||
target: x86_64-unknown-linux-musl
|
target: x86_64-unknown-linux-musl
|
||||||
packages: apt
|
|
||||||
|
|
||||||
- build: debian
|
|
||||||
os: ubuntu-22.04
|
|
||||||
target: x86_64-unknown-linux-musl
|
|
||||||
packages: apt
|
|
||||||
|
|
||||||
- build: macos
|
- build: macos
|
||||||
os: macos-latest
|
os: macos-latest
|
||||||
target: x86_64-apple-darwin
|
target: x86_64-apple-darwin
|
||||||
packages: brew
|
|
||||||
|
|
||||||
- build: arm-macos
|
- build: arm-macos
|
||||||
os: macos-latest
|
os: macos-latest
|
||||||
target: aarch64-apple-darwin
|
target: aarch64-apple-darwin
|
||||||
packages: brew
|
|
||||||
|
|
||||||
- build: windows
|
- build: windows
|
||||||
os: windows-2022
|
os: windows-2022
|
||||||
target: x86_64-pc-windows-msvc
|
target: x86_64-pc-windows-msvc
|
||||||
packages: none
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install packages (linux)
|
- name: Install packages (linux)
|
||||||
if: matrix.packages == 'apt'
|
if: matrix.build == 'linux'
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y pandoc
|
sudo apt-get install -y pandoc
|
||||||
|
|
||||||
- name: Install packages (macos)
|
- name: Install packages (macos)
|
||||||
if: matrix.packages == 'brew'
|
if: matrix.build == 'macos' || matrix.build == 'arm-macos'
|
||||||
run: |
|
run: |
|
||||||
brew update
|
brew update
|
||||||
brew install pandoc
|
brew install pandoc
|
||||||
|
|
|
||||||
24
Cargo.toml
24
Cargo.toml
|
|
@ -1,14 +1,12 @@
|
||||||
[package]
|
[package]
|
||||||
name = "fwd"
|
name = "fwd"
|
||||||
version = "0.9.2"
|
version = "0.9.2"
|
||||||
authors = ["John Doty <john@d0ty.me>"]
|
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
description = "Automatically forward ports to a remote server"
|
description = "Automatically forward ports to a remote server over ssh"
|
||||||
readme = "README.md"
|
|
||||||
documentation = "https://github.com/DeCarabas/fwd"
|
|
||||||
homepage = "https://github.com/DeCarabas/fwd"
|
homepage = "https://github.com/DeCarabas/fwd"
|
||||||
repository = "https://github.com/DeCarabas/fwd"
|
repository = "https://github.com/DeCarabas/fwd"
|
||||||
|
readme = "README.md"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "fwd-browse"
|
name = "fwd-browse"
|
||||||
|
|
@ -43,21 +41,3 @@ procfs = "0.14.1"
|
||||||
|
|
||||||
[target.'cfg(target_family="unix")'.dependencies]
|
[target.'cfg(target_family="unix")'.dependencies]
|
||||||
libc = "0.2.155"
|
libc = "0.2.155"
|
||||||
|
|
||||||
[package.metadata.deb]
|
|
||||||
section = "net"
|
|
||||||
depends = [] # No auto deps?
|
|
||||||
assets = [
|
|
||||||
["target/release/fwd", "usr/bin/", "755"],
|
|
||||||
["LICENSE", "usr/share/doc/fwd/", "644"],
|
|
||||||
["README.md", "usr/share/doc/fwd/README", "644"],
|
|
||||||
# The man page is automatically generated by fwd's build process. See
|
|
||||||
# release.py for details.
|
|
||||||
["target/release/fwd.1", "usr/share/man/man1/fwd.1", "644"],
|
|
||||||
]
|
|
||||||
extended-description = """\
|
|
||||||
fwd enumerates the listening ports the remote server and automatically listens
|
|
||||||
for connections on the same ports on the local machine. When fwd receives a
|
|
||||||
connection on the local machine, it automatically forwards that connection to
|
|
||||||
the remote machine.
|
|
||||||
"""
|
|
||||||
|
|
|
||||||
2
LICENSE
2
LICENSE
|
|
@ -1,4 +1,4 @@
|
||||||
Copyright 2024 John Doty
|
Copyright 2022 John Doty
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ A port-forwarding utility.
|
||||||
|
|
||||||
Here's how it works:
|
Here's how it works:
|
||||||
1. Get the latest [release](https://github.com/DeCarabas/fwd/releases) of `fwd`
|
1. Get the latest [release](https://github.com/DeCarabas/fwd/releases) of `fwd`
|
||||||
2. You install `fwd` on the server somewhere in your `$PATH` (like `/usr/bin/`, or `.local/bin`)
|
2. You install `fwd` on the server somewhere in your `$PATH` (like `/usr/bin/`)
|
||||||
3. You install `fwd` on the client (like your laptop)
|
3. You install `fwd` on the client (like your laptop)
|
||||||
4. You run `fwd` on the client to connect to the server, like so:
|
4. You run `fwd` on the client to connect to the server, like so:
|
||||||
|
|
||||||
|
|
@ -21,3 +21,9 @@ If the port is something that might be interesting to a web browser, you can pre
|
||||||
If something is going wrong, pressing `l` will toggle logs that might explain it.
|
If something is going wrong, pressing `l` will toggle logs that might explain it.
|
||||||
|
|
||||||
Press `q` to quit.
|
Press `q` to quit.
|
||||||
|
|
||||||
|
## Future Improvements:
|
||||||
|
|
||||||
|
- Clipboard integration: send something from the remote end of the pipe to the host's clipboard. (Sometimes you *really* want to copy some big buffer from the remote side and your terminal just can't make that work.)
|
||||||
|
|
||||||
|
- Client heartbeats: I frequently wind up in a situation where the pipe is stalled: not broken but nothing is getting through. (This happens with my coder.com pipes all the time.)
|
||||||
|
|
|
||||||
69
release.py
69
release.py
|
|
@ -5,7 +5,6 @@ little nicer for running commands, it's worse at everything else.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import enum
|
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
@ -19,20 +18,14 @@ if BUILD is None:
|
||||||
raise Exception("you *must* set the BUILD environment variable")
|
raise Exception("you *must* set the BUILD environment variable")
|
||||||
|
|
||||||
|
|
||||||
class Archive(enum.Enum):
|
|
||||||
TARBALL = 1
|
|
||||||
ZIP = 2
|
|
||||||
DEB = 3
|
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass
|
@dataclasses.dataclass
|
||||||
class BuildSettings:
|
class BuildSettings:
|
||||||
target: str # The rust target to build for
|
target: str
|
||||||
test: bool = True # Whether or not to run tests
|
test: bool = True
|
||||||
man_page: bool = True # Whether or not to generate a man page
|
man_page: bool = True
|
||||||
strip: bool = True # Whether or not to strip binaries
|
strip: bool = True
|
||||||
archive: Archive = Archive.TARBALL # Archive type
|
windows: bool = False
|
||||||
ext: str = "" # The file extension of the binary
|
ext: str = ""
|
||||||
|
|
||||||
|
|
||||||
print(f"doing release: {BUILD}")
|
print(f"doing release: {BUILD}")
|
||||||
|
|
@ -40,11 +33,6 @@ build = {
|
||||||
"linux": BuildSettings(
|
"linux": BuildSettings(
|
||||||
target="x86_64-unknown-linux-musl",
|
target="x86_64-unknown-linux-musl",
|
||||||
),
|
),
|
||||||
"deb": BuildSettings(
|
|
||||||
target="x86_64-unknown-linux-musl",
|
|
||||||
test=False,
|
|
||||||
archive=Archive.DEB,
|
|
||||||
),
|
|
||||||
"macos": BuildSettings(
|
"macos": BuildSettings(
|
||||||
target="x86_64-apple-darwin",
|
target="x86_64-apple-darwin",
|
||||||
),
|
),
|
||||||
|
|
@ -55,7 +43,7 @@ build = {
|
||||||
target="x86_64-pc-windows-msvc",
|
target="x86_64-pc-windows-msvc",
|
||||||
strip=False,
|
strip=False,
|
||||||
man_page=False,
|
man_page=False,
|
||||||
archive=Archive.ZIP,
|
windows=True,
|
||||||
ext=".exe",
|
ext=".exe",
|
||||||
),
|
),
|
||||||
}[BUILD]
|
}[BUILD]
|
||||||
|
|
@ -112,50 +100,29 @@ def build_docs(staging: pathlib.Path):
|
||||||
f.write(contents)
|
f.write(contents)
|
||||||
|
|
||||||
|
|
||||||
def build_archive(staging: pathlib.Path) -> pathlib.Path:
|
|
||||||
print("Creating archive...")
|
|
||||||
if build.archive == Archive.ZIP:
|
|
||||||
archive = pathlib.Path(f"{staging}.zip")
|
|
||||||
subprocess.run(["7z", "a", archive, f"{staging}"], check=True)
|
|
||||||
|
|
||||||
elif build.archive == Archive.DEB:
|
|
||||||
subprocess.run(["cargo", "install", "cargo-deb"], check=True)
|
|
||||||
shutil.copyfile(staging / "fwd.1", target_dir / "fwd.1")
|
|
||||||
subprocess.run(["cargo", "deb", "--target", build.target], check=True)
|
|
||||||
|
|
||||||
# Knowing the deb path means knowing the target version but I don't
|
|
||||||
# actually have the version here. (Or, like, I have the release tag
|
|
||||||
# but not in testing.) So just find the hopefully singular .deb that
|
|
||||||
# we made.
|
|
||||||
deb_path = pathlib.Path("target") / build.target / "debian"
|
|
||||||
archives = list(deb_path.glob("*.deb"))
|
|
||||||
assert len(archives) == 1
|
|
||||||
archive = archives[0]
|
|
||||||
|
|
||||||
else:
|
|
||||||
assert build.archive == Archive.TARBALL
|
|
||||||
archive = pathlib.Path(f"{staging}.tar.gz")
|
|
||||||
subprocess.run(["tar", "czf", archive, f"{staging}"], check=True)
|
|
||||||
|
|
||||||
return archive
|
|
||||||
|
|
||||||
|
|
||||||
staging = pathlib.Path(f"fwd-{build.target}")
|
staging = pathlib.Path(f"fwd-{build.target}")
|
||||||
os.makedirs(staging, exist_ok=True)
|
os.makedirs(staging, exist_ok=True)
|
||||||
|
|
||||||
build_and_test(staging)
|
build_and_test(staging)
|
||||||
build_docs(staging)
|
build_docs(staging)
|
||||||
archive = build_archive(staging)
|
|
||||||
|
print("Creating archive...")
|
||||||
|
if build.windows:
|
||||||
|
archive = f"{staging}.zip"
|
||||||
|
subprocess.run(["7z", "a", archive, f"{staging}"], check=True)
|
||||||
|
else:
|
||||||
|
archive = f"{staging}.tar.gz"
|
||||||
|
subprocess.run(["tar", "czf", archive, f"{staging}"], check=True)
|
||||||
|
|
||||||
shutil.rmtree(staging)
|
shutil.rmtree(staging)
|
||||||
|
|
||||||
assert archive.exists()
|
|
||||||
if RELEASE_TAG is None:
|
if RELEASE_TAG is None:
|
||||||
print(f"Not releasing {archive} to github, RELEASE_TAG is none.")
|
print("Not releasing to github, RELEASE_TAG is none.")
|
||||||
else:
|
else:
|
||||||
print(f"Uploading {archive} to github release {RELEASE_TAG}...")
|
print(f"Uploading {archive} to github release {RELEASE_TAG}...")
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["gh", "release", "upload", RELEASE_TAG, archive, "--clobber"],
|
["gh", "release", "upload", RELEASE_TAG, archive, "--clobber"],
|
||||||
check=True,
|
check=True,
|
||||||
)
|
)
|
||||||
os.unlink(archive)
|
|
||||||
|
os.unlink(archive)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue