Skip to content

Commit

Permalink
Merge branch 'release/0.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
nwtgck committed Apr 29, 2024
2 parents 1783609 + a5ce099 commit 21dcc79
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 798 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: CI

on: [push, pull_request]
on: [push]

jobs:
build_multi_platform:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.16
go-version: '1.20'
- name: Build for multi-platform
run: |
set -xeu
Expand All @@ -30,15 +30,15 @@ jobs:
CGO_ENABLED=0 go build -o "${BUILD_PATH}/piping-tunnel${EXTENSION}" main/main.go
done
operational_test:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- name: Build SSH server Dockerfile
run: |
docker build -t ssh-server - <<'EOS'
FROM ubuntu:18.04
FROM ubuntu:20.04
RUN apt update
RUN apt install -y openssh-server
RUN mkdir /var/run/sshd
Expand All @@ -63,11 +63,11 @@ jobs:
run: docker run -d -p 8888:80 nginx:alpine
- name: Run Piping Server
run: docker run -d -p 8080:8080 nwtgck/piping-server:v1.2.0
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.16
go-version: '1.20'
- run: CGO_ENABLED=0 go build -o piping-tunnel main/main.go

- name: Normal tunnel
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ on:

jobs:
goreleaser:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.16
go-version: '1.20'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v5
with:
version: v1.0.0
version: v1.19.2
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

## [Unreleased]

## [0.11.0] - 2024-04-29
### Changed
* Update dependencies
* Use 4096 bytes for buffer by default

## [0.10.2] - 2022-01-15
### Changed
* Update dependencies
Expand Down Expand Up @@ -105,7 +110,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
### Added
* Initial release

[Unreleased]: https://github.com/nwtgck/go-piping-tunnel/compare/v0.10.2...HEAD
[Unreleased]: https://github.com/nwtgck/go-piping-tunnel/compare/v0.11.0...HEAD
[0.11.0]: https://github.com/nwtgck/go-piping-tunnel/compare/v0.10.2...v0.11.0
[0.10.2]: https://github.com/nwtgck/go-piping-tunnel/compare/v0.10.1...v0.10.2
[0.10.1]: https://github.com/nwtgck/go-piping-tunnel/compare/v0.10.0...v0.10.1
[0.10.0]: https://github.com/nwtgck/go-piping-tunnel/compare/v0.9.0...v0.10.0
Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Environment variable:
Available Commands:
client Run client-host
completion Generate the autocompletion script for the specified shell
help Help about any command
server Run server-host
socks Run SOCKS server
Expand All @@ -63,8 +64,8 @@ Flags:
--dns-server string DNS server (e.g. 1.1.1.1:53)
-H, --header stringArray HTTP header
-h, --help help for piping-tunnel
--http-read-buf-size int HTTP read-buffer size in bytes (default 16)
--http-write-buf-size int HTTP write-buffer size in bytes (default 16)
--http-read-buf-size int HTTP read-buffer size in bytes (default 4096)
--http-write-buf-size int HTTP write-buffer size in bytes (default 4096)
-k, --insecure Allow insecure server connections when using SSL
--progress Show progress (default true)
-s, --server string Piping Server URL (default "https://ppng.io")
Expand All @@ -83,7 +84,7 @@ Usage:
Flags:
--cipher-type string Cipher type: aes-ctr, openssl-aes-128-ctr, openssl-aes-256-ctr, openpgp (default "aes-ctr")
--cs-buf-size uint Buffer size of client-to-server in bytes (default 16)
--cs-buf-size uint Buffer size of client-to-server in bytes (default 4096)
-h, --help help for server
--host string Target host (default "localhost")
--pass string Passphrase for encryption
Expand All @@ -98,8 +99,8 @@ Flags:
Global Flags:
--dns-server string DNS server (e.g. 1.1.1.1:53)
-H, --header stringArray HTTP header
--http-read-buf-size int HTTP read-buffer size in bytes (default 16)
--http-write-buf-size int HTTP write-buffer size in bytes (default 16)
--http-read-buf-size int HTTP read-buffer size in bytes (default 4096)
--http-write-buf-size int HTTP write-buffer size in bytes (default 4096)
-k, --insecure Allow insecure server connections when using SSL
--progress Show progress (default true)
-s, --server string Piping Server URL (default "https://ppng.io")
Expand All @@ -121,16 +122,16 @@ Flags:
--pmux Multiplex connection by pmux (experimental)
--pmux-config string pmux config in JSON (experimental) (default "{\"hb\": true}")
-p, --port int TCP port of client host
--sc-buf-size uint Buffer size of server-to-client in bytes (default 16)
--sc-buf-size uint Buffer size of server-to-client in bytes (default 4096)
-c, --symmetric Encrypt symmetrically
--unix-socket string Unix socket of client host
--yamux Multiplex connection by hashicorp/yamux
Global Flags:
--dns-server string DNS server (e.g. 1.1.1.1:53)
-H, --header stringArray HTTP header
--http-read-buf-size int HTTP read-buffer size in bytes (default 16)
--http-write-buf-size int HTTP write-buffer size in bytes (default 16)
--http-read-buf-size int HTTP read-buffer size in bytes (default 4096)
--http-write-buf-size int HTTP write-buffer size in bytes (default 4096)
-k, --insecure Allow insecure server connections when using SSL
--progress Show progress (default true)
-s, --server string Piping Server URL (default "https://ppng.io")
Expand Down Expand Up @@ -158,8 +159,8 @@ Flags:
Global Flags:
--dns-server string DNS server (e.g. 1.1.1.1:53)
-H, --header stringArray HTTP header
--http-read-buf-size int HTTP read-buffer size in bytes (default 16)
--http-write-buf-size int HTTP write-buffer size in bytes (default 16)
--http-read-buf-size int HTTP read-buffer size in bytes (default 4096)
--http-write-buf-size int HTTP write-buffer size in bytes (default 4096)
-k, --insecure Allow insecure server connections when using SSL
--progress Show progress (default true)
-s, --server string Piping Server URL (default "https://ppng.io")
Expand Down
20 changes: 12 additions & 8 deletions cmd/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func init() {
cmd.RootCmd.AddCommand(clientCmd)
clientCmd.Flags().IntVarP(&flag.clientHostPort, "port", "p", 0, "TCP port of client host")
clientCmd.Flags().StringVarP(&flag.clientHostUnixSocket, "unix-socket", "", "", "Unix socket of client host")
clientCmd.Flags().UintVarP(&flag.serverToClientBufSize, "sc-buf-size", "", 16, "Buffer size of server-to-client in bytes")
clientCmd.Flags().UintVarP(&flag.serverToClientBufSize, "sc-buf-size", "", 4096, "Buffer size of server-to-client in bytes")
clientCmd.Flags().BoolVarP(&flag.yamux, cmd.YamuxFlagLongName, "", false, "Multiplex connection by hashicorp/yamux")
clientCmd.Flags().BoolVarP(&flag.pmux, cmd.PmuxFlagLongName, "", false, "Multiplex connection by pmux (experimental)")
clientCmd.Flags().StringVarP(&flag.pmuxConfig, cmd.PmuxConfigFlagLongName, "", `{"hb": true}`, "pmux config in JSON (experimental)")
Expand Down Expand Up @@ -132,13 +132,13 @@ var clientCmd = &cobra.Command{
fin := make(chan error)
go func() {
// TODO: hard code
var buf = make([]byte, 16)
var buf = make([]byte, 4096)
_, err := io.CopyBuffer(duplex, conn, buf)
fin <- err
}()
go func() {
// TODO: hard code
var buf = make([]byte, 16)
var buf = make([]byte, 4096)
_, err := io.CopyBuffer(conn, duplex, buf)
fin <- err
}()
Expand Down Expand Up @@ -264,13 +264,13 @@ func clientHandleWithYamux(ln net.Listener, httpClient *http.Client, headers []p
fin := make(chan struct{})
go func() {
// TODO: hard code
var buf = make([]byte, 16)
var buf = make([]byte, 4096)
io.CopyBuffer(yamuxStream, conn, buf)
fin <- struct{}{}
}()
go func() {
// TODO: hard code
var buf = make([]byte, 16)
var buf = make([]byte, 4096)
io.CopyBuffer(conn, yamuxStream, buf)
fin <- struct{}{}
}()
Expand Down Expand Up @@ -305,7 +305,11 @@ func clientHandleWithPmux(ln net.Listener, httpClient *http.Client, headers []pi
for {
conn, err := ln.Accept()
if err != nil {
break
cmd.Vlog.Log(
fmt.Sprintf("error(accept): %v", errors.WithStack(err)),
fmt.Sprintf("error(accept): %+v", errors.WithStack(err)),
)
continue
}
stream, err := pmuxClient.Open()
if err != nil {
Expand All @@ -318,7 +322,7 @@ func clientHandleWithPmux(ln net.Listener, httpClient *http.Client, headers []pi
fin := make(chan struct{})
go func() {
// TODO: hard code
var buf = make([]byte, 16)
var buf = make([]byte, 4096)
_, err := io.CopyBuffer(conn, stream, buf)
fin <- struct{}{}
if err != nil {
Expand All @@ -332,7 +336,7 @@ func clientHandleWithPmux(ln net.Listener, httpClient *http.Client, headers []pi

go func() {
// TODO: hard code
var buf = make([]byte, 16)
var buf = make([]byte, 4096)
_, err := io.CopyBuffer(stream, conn, buf)
fin <- struct{}{}
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ func init() {
// NOTE: --insecure, -k is inspired by curl
RootCmd.PersistentFlags().BoolVarP(&Insecure, "insecure", "k", false, "Allow insecure server connections when using SSL")
RootCmd.PersistentFlags().StringArrayVarP(&HeaderKeyValueStrs, "header", "H", []string{}, "HTTP header")
RootCmd.PersistentFlags().IntVarP(&HttpWriteBufSize, "http-write-buf-size", "", 16, "HTTP write-buffer size in bytes")
RootCmd.PersistentFlags().IntVarP(&HttpReadBufSize, "http-read-buf-size", "", 16, "HTTP read-buffer size in bytes")
RootCmd.PersistentFlags().IntVarP(&HttpWriteBufSize, "http-write-buf-size", "", 4096, "HTTP write-buffer size in bytes")
RootCmd.PersistentFlags().IntVarP(&HttpReadBufSize, "http-read-buf-size", "", 4096, "HTTP read-buffer size in bytes")
RootCmd.PersistentFlags().BoolVarP(&ShowProgress, "progress", "", true, "Show progress")
RootCmd.Flags().BoolVarP(&showsVersion, "version", "v", false, "show version")
RootCmd.PersistentFlags().IntVarP(&verboseLoggerLevel, "verbose", "", 0, "Verbose logging level")
Expand Down
20 changes: 12 additions & 8 deletions cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func init() {
serverCmd.Flags().StringVarP(&flag.targetHost, "host", "", "localhost", "Target host")
serverCmd.Flags().IntVarP(&flag.serverHostPort, "port", "p", 0, "TCP port of server host")
serverCmd.Flags().StringVarP(&flag.serverHostUnixSocket, "unix-socket", "", "", "Unix socket of server host")
serverCmd.Flags().UintVarP(&flag.clientToServerBufSize, "cs-buf-size", "", 16, "Buffer size of client-to-server in bytes")
serverCmd.Flags().UintVarP(&flag.clientToServerBufSize, "cs-buf-size", "", 4096, "Buffer size of client-to-server in bytes")
serverCmd.Flags().BoolVarP(&flag.yamux, cmd.YamuxFlagLongName, "", false, "Multiplex connection by hashicorp/yamux")
serverCmd.Flags().BoolVarP(&flag.pmux, cmd.PmuxFlagLongName, "", false, "Multiplex connection by pmux (experimental)")
serverCmd.Flags().StringVarP(&flag.pmuxConfig, cmd.PmuxConfigFlagLongName, "", `{"hb": true}`, "pmux config in JSON (experimental)")
Expand Down Expand Up @@ -125,13 +125,13 @@ var serverCmd = &cobra.Command{
fin := make(chan error)
go func() {
// TODO: hard code
var buf = make([]byte, 16)
var buf = make([]byte, 4096)
_, err := io.CopyBuffer(duplex, conn, buf)
fin <- err
}()
go func() {
// TODO: hard code
var buf = make([]byte, 16)
var buf = make([]byte, 4096)
_, err := io.CopyBuffer(conn, duplex, buf)
fin <- err
}()
Expand Down Expand Up @@ -248,13 +248,13 @@ func serverHandleWithYamux(httpClient *http.Client, headers []piping_util.KeyVal
fin := make(chan struct{})
go func() {
// TODO: hard code
var buf = make([]byte, 16)
var buf = make([]byte, 4096)
io.CopyBuffer(yamuxStream, conn, buf)
fin <- struct{}{}
}()
go func() {
// TODO: hard code
var buf = make([]byte, 16)
var buf = make([]byte, 4096)
io.CopyBuffer(conn, yamuxStream, buf)
fin <- struct{}{}
}()
Expand Down Expand Up @@ -290,12 +290,16 @@ func serverHandleWithPmux(httpClient *http.Client, headers []piping_util.KeyValu
for {
stream, err := pmuxServer.Accept()
if err != nil {
return err
cmd.Vlog.Log(
fmt.Sprintf("error(pmux accept): %v", errors.WithStack(err)),
fmt.Sprintf("error(pmux accept): %+v", errors.WithStack(err)),
)
continue
}
conn := dialLoop()
go func() {
// TODO: hard code
var buf = make([]byte, 16)
var buf = make([]byte, 4096)
_, err := io.CopyBuffer(conn, stream, buf)
if err != nil {
cmd.Vlog.Log(
Expand All @@ -309,7 +313,7 @@ func serverHandleWithPmux(httpClient *http.Client, headers []piping_util.KeyValu

go func() {
// TODO: hard code
var buf = make([]byte, 16)
var buf = make([]byte, 4096)
_, err := io.CopyBuffer(stream, conn, buf)
if err != nil {
cmd.Vlog.Log(
Expand Down
10 changes: 6 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ module github.com/nwtgck/go-piping-tunnel
go 1.16

require (
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce
github.com/mattn/go-tty v0.0.3
github.com/hashicorp/yamux v0.1.1
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-tty v0.0.5
github.com/nwtgck/go-socks v0.1.0
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.3.0
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5
github.com/spf13/cobra v1.8.0
golang.org/x/crypto v0.22.0
golang.org/x/net v0.24.0 // indirect
)
Loading

0 comments on commit 21dcc79

Please sign in to comment.