mirror of
https://github.com/proxytunnel/proxytunnel.git
synced 2026-01-23 10:36:13 +00:00
Compare commits
23 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f32a099f9 | ||
|
|
320ad4be83 | ||
|
|
c43ba13e02 | ||
|
|
9203bdfef7 | ||
|
|
cd358101fb | ||
|
|
882a22d80d | ||
|
|
9db6e3b3d3 | ||
|
|
b4ddf94b45 | ||
|
|
77b9afda27 | ||
|
|
b4ed20677c | ||
|
|
85eeaabe28 | ||
|
|
2e61c609bb | ||
|
|
226c45c969 | ||
|
|
2ef739f7c2 | ||
|
|
f320f2bf63 | ||
|
|
ad8a6a1c7e | ||
|
|
5e9a22d035 | ||
|
|
c4c6caafbb | ||
|
|
4982420160 | ||
|
|
8ab065fca1 | ||
|
|
3ec1efe42e | ||
|
|
20be023202 | ||
|
|
c5ab464877 |
8 changed files with 193 additions and 20 deletions
49
INSTALL.md
49
INSTALL.md
|
|
@ -10,6 +10,55 @@ to build simply run `make` and optionally `make install`.
|
|||
If you manually want to install, copy proxytunnel to /usr/local/bin
|
||||
and optionally the manual-page from the debian-subdirectory to your manpath
|
||||
|
||||
# Nix Flakes
|
||||
|
||||
> NOTE: The Nix Flake installation currently only supports the `x86_64-linux` platform, and has not been tested on other architectures.
|
||||
|
||||
A simple Nix Flake is included to allow for use via flake inputs. To create a temporary Nix Shell with access to the `proxytunnel` binary, you can run the command:
|
||||
```console
|
||||
nix develop github:proxytunnel/proxytunnel
|
||||
```
|
||||
If you instead want to include it as a flake input, the following `flake.nix` shows how to do so:
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
# Add proxytunnel as an input
|
||||
proxytunnel.url = "github:proxytunnel/proxytunnel";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
nixpkgs,
|
||||
proxytunnel,
|
||||
...
|
||||
}: let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs {
|
||||
system = "x86_64-linux";
|
||||
overlays = [
|
||||
# Add proxytunnel's default features to your nixpkgs
|
||||
proxytunnel = proxytunnel.overlays.default;
|
||||
|
||||
# For a full list of override options, see `nix/proxytunnel.nix`
|
||||
];
|
||||
};
|
||||
in {
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
packages = [
|
||||
# Make the `proxytunnel` binary available in a Nix Shell
|
||||
# The above overlay adds it to nixpkgs. Without the overlay, use proxytunnel.packages.${system}.default
|
||||
pkgs.proxytunnel
|
||||
|
||||
# And include any other packages as desired...
|
||||
pkgs.gcc
|
||||
# ...
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
# msys2
|
||||
|
||||
To install msys2 with [chocolatey](https://chocolatey.org/install):
|
||||
|
|
|
|||
17
Makefile
17
Makefile
|
|
@ -14,19 +14,19 @@ OPTFLAGS += -DHAVE_GETOPT_LONG
|
|||
# Comment if you don't have/want ssl
|
||||
OPTFLAGS += -DUSE_SSL
|
||||
|
||||
# Most systems
|
||||
OPTFLAGS += -DSETPROCTITLE -DSPT_TYPE=2
|
||||
|
||||
# System dependant blocks... if your system is listed below, uncomment
|
||||
# the relevant lines
|
||||
|
||||
# MSYS
|
||||
# The current version of gcc from MSYS defines __MSYS__ and __CYGWIN__.
|
||||
# To avoid to change the code, simply define CYGWIN additionally.
|
||||
ifneq ($(filter $(MSYSTEM),MSYS MINGW32 MINGW64 UCRT64),)
|
||||
CFLAGS += -DCYGWIN
|
||||
else
|
||||
# Most systems, MSYS definitely not
|
||||
OPTFLAGS += -DSETPROCTITLE -DSPT_TYPE=2
|
||||
endif
|
||||
|
||||
# System dependant blocks... if your system is listed below, uncomment
|
||||
# the relevant lines
|
||||
|
||||
# OpenBSD
|
||||
#OPTFLAGS += -DHAVE_SYS_PSTAT_H
|
||||
|
||||
|
|
@ -66,7 +66,6 @@ mandir = $(datadir)/man
|
|||
OBJ = proxytunnel.o \
|
||||
base64.o \
|
||||
strzcat.o \
|
||||
setproctitle.o \
|
||||
io.o \
|
||||
http.o \
|
||||
basicauth.o \
|
||||
|
|
@ -77,6 +76,10 @@ OBJ = proxytunnel.o \
|
|||
ntlm.o \
|
||||
ptstream.o
|
||||
|
||||
ifneq (,$(findstring -DSETPROCTITLE,$(OPTFLAGS)))
|
||||
OBJ += setproctitle.o
|
||||
endif
|
||||
|
||||
UNAME = $(shell uname)
|
||||
ifneq ($(UNAME),Darwin)
|
||||
OBJ += strlcpy.o \
|
||||
|
|
|
|||
|
|
@ -596,7 +596,7 @@ int cmdline_parser( int argc, char * const *argv, struct gengetopt_args_info *ar
|
|||
}
|
||||
}
|
||||
|
||||
if (! args_info->proxy_given && ! args_info->dest_given ) {
|
||||
if (! args_info->proxy_given || ! args_info->dest_given ) {
|
||||
clear_args ();
|
||||
// cmdline_parser_print_help ();
|
||||
message( "No proxy or destination given, exiting\nUse '--help' flag for usage info\n" );
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ proxytunnel - program to tunnel a connection through a standard HTTPS proxy
|
|||
|
||||
|
||||
== SYNOPSIS
|
||||
*proxytunnel* [_OPTION…_] [_host_++:++_port_]
|
||||
*proxytunnel* [_OPTION…_]
|
||||
|
||||
|
||||
== DESCRIPTION
|
||||
|
|
@ -32,15 +32,16 @@ also be used for other proxy-traversing purposes like proxy bouncing.
|
|||
[2001:db8::123:4567:89ab:cdef%eth0]:22
|
||||
|
||||
*-p*, *--proxy*=_host_++:++_port_::
|
||||
Use _host_ and _port_ as the local proxy to connect to, if not specified
|
||||
the *HTTP_PROXY* environment variable, if set, will be used instead.
|
||||
Use _host_ and _port_ as the local (primary) proxy to connect to, if not
|
||||
specified the *HTTP_PROXY* environment variable, if set, will be used
|
||||
instead. This option or the environment variable are mandatory.
|
||||
|
||||
*-r*, *--remproxy*=_host_++:++_port_::
|
||||
Use _host_ and _port_ as the remote (secondary) proxy to connect to.
|
||||
|
||||
*-d*, *--dest*=_host_++:++_port_::
|
||||
Use _host_ and _port_ as the destination for the tunnel, you can also
|
||||
specify them as the argument to the proxytunnel command.
|
||||
Use _host_ and _port_ as the destination for the tunnel. This is a
|
||||
mandatory option.
|
||||
|
||||
*-e*, *--encrypt*::
|
||||
SSL encrypt data between local proxy and destination.
|
||||
|
|
@ -150,13 +151,6 @@ also be used for other proxy-traversing purposes like proxy bouncing.
|
|||
Print version and exit.
|
||||
|
||||
|
||||
== ARGUMENTS
|
||||
_host_++:++_port_ is the destination hostname and port number combination.
|
||||
|
||||
NOTE: Specifying the destination as arguments is exactly the same as
|
||||
specifying them using the *-d* or *--dest* option.
|
||||
|
||||
|
||||
== USAGE
|
||||
Depending on your situation you might want to do any of the following things:
|
||||
|
||||
|
|
|
|||
61
flake.lock
generated
Normal file
61
flake.lock
generated
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1743550720,
|
||||
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1743583204,
|
||||
"narHash": "sha256-F7n4+KOIfWrwoQjXrL2wD9RhFYLs2/GGe/MQY1sSdlE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2c8d3f48d33929642c1c12cd243df4cc7d2ce434",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1743296961,
|
||||
"narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
33
flake.nix
Normal file
33
flake.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
description = "Basic flake that provides proxytunnel as a package or as a binary in a nix shell";
|
||||
|
||||
inputs = {
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs = inputs @ {flake-parts, ...}:
|
||||
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
# TODO: Add support for more systems once checked.
|
||||
systems = ["x86_64-linux"];
|
||||
|
||||
imports = [inputs.flake-parts.flakeModules.easyOverlay];
|
||||
|
||||
perSystem = {
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
overlayAttrs = {
|
||||
inherit (config.packages) proxytunnel;
|
||||
};
|
||||
|
||||
packages.proxytunnel = pkgs.callPackage ./nix/proxytunnel.nix {};
|
||||
packages.default = config.packages.proxytunnel;
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = [config.packages.default];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
31
nix/proxytunnel.nix
Normal file
31
nix/proxytunnel.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
gnu-system ? true,
|
||||
set-proc-title ? true,
|
||||
pkgs,
|
||||
}: let
|
||||
optflags = "-DUSE_SSL ${
|
||||
if gnu-system
|
||||
then "-DHAVE_GETOPT_LONG"
|
||||
else ""
|
||||
} ${
|
||||
if set-proc-title
|
||||
then "-DSETPROCTITLE -DSPT_TYPE=2"
|
||||
else ""
|
||||
}";
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
pname = "proxytunnel";
|
||||
version = "1.12.3";
|
||||
src = ./..;
|
||||
|
||||
buildInputs = [pkgs.openssl];
|
||||
|
||||
buildPhase = ''
|
||||
make OPTFLAGS="${optflags}"
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp ./proxytunnel $out/bin
|
||||
'';
|
||||
}
|
||||
|
|
@ -30,8 +30,10 @@ void analyze_HTTP(PTSTREAM *pts);
|
|||
void proxy_protocol(PTSTREAM *pts);
|
||||
void closeall();
|
||||
void do_daemon();
|
||||
#ifdef SETPROCTITLE
|
||||
void initsetproctitle(int argc, char *argv[]);
|
||||
void setproctitle(const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
/* Don't include strlcat and strlcpy since they are provided as macros on OSX */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue