Skip to content

Commit

Permalink
Merge branch 'release/0.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
nwtgck committed Dec 26, 2020
2 parents 0e0c7a2 + f5af394 commit c55f255
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 17 deletions.
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.7.0] - 2020-12-26
### Changed
* Add examples to help
* Silent usage when error occurred

## [0.6.0] - 2020-12-26
### Changed
* (internal) Improve performance when showing the progress bar
Expand Down Expand Up @@ -64,7 +69,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.6.0...HEAD
[Unreleased]: https://github.com/nwtgck/go-piping-tunnel/compare/v0.7.0...HEAD
[0.7.0]: https://github.com/nwtgck/go-piping-tunnel/compare/v0.6.0...v0.7.0
[0.6.0]: https://github.com/nwtgck/go-piping-tunnel/compare/v0.5.0...v0.6.0
[0.5.0]: https://github.com/nwtgck/go-piping-tunnel/compare/v0.4.2...v0.5.0
[0.4.2]: https://github.com/nwtgck/go-piping-tunnel/compare/v0.4.1...v0.4.2
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tunneling over HTTP with [Piping Server](https://github.com/nwtgck/piping-server


## Install for Windows
[Download](https://github.com/nwtgck/go-piping-tunnel/releases/download/v0.4.2/piping-tunnel-0.4.2-windows-amd64.zip)
[Download](https://github.com/nwtgck/go-piping-tunnel/releases/download/v0.7.0/piping-tunnel-0.7.0-windows-amd64.zip)

## Install for macOS
```bash
Expand All @@ -14,8 +14,8 @@ brew install nwtgck/piping-tunnel/piping-tunnel

## Install for Ubuntu
```bash
wget https://github.com/nwtgck/go-piping-tunnel/releases/download/v0.4.2/piping-tunnel-0.4.2-linux-amd64.deb
dpkg -i piping-tunnel-0.4.2-linux-amd64.deb
wget https://github.com/nwtgck/go-piping-tunnel/releases/download/v0.7.0/piping-tunnel-0.7.0-linux-amd64.deb
dpkg -i piping-tunnel-0.7.0-linux-amd64.deb
```

Get more executables in the [releases](https://github.com/nwtgck/go-piping-tunnel/releases).
Expand Down
4 changes: 3 additions & 1 deletion cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ var clientCmd = &cobra.Command{
req.Header.Set(kv.Key, kv.Value)
}
res, err := httpClient.Do(req)
if err != nil {
return err
}
var writer io.Writer = conn
if progress != nil {
writer = io.MultiWriter(conn, progress)
Expand Down Expand Up @@ -174,5 +177,4 @@ func clientHandleWithYamux(ln net.Listener, httpClient *http.Client, headers []p
io.CopyBuffer(conn, yamuxStream, buf)
}()
}
return nil
}
27 changes: 24 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,30 @@ func init() {
}

var RootCmd = &cobra.Command{
Use: os.Args[0],
Short: "piping-tunnel",
Long: "Tunnel over Piping Server",
Use: os.Args[0],
Short: "piping-tunnel",
Long: "Tunnel over Piping Server",
SilenceUsage: true,
Example: fmt.Sprintf(`
Normal:
piping-tunnel server -p 22 aaa bbb
piping-tunnel client -p 1022 aaa bbb
Short:
piping-tunnel server -p 22 aaa
piping-tunnel client -p 1022 aaa
Multiplexing:
piping-tunnel server -p 22 --yamux aaa bbb
piping-tunnel client -p 1022 --yamux aaa bbb
SOCKS5 like VPN:
piping-tunnel socks --yamux aaa bbb
piping-tunnel client -p 1080 --yamux aaa bbb
Environment variable:
$%s for default Piping Server
`, ServerUrlEnvName),
RunE: func(cmd *cobra.Command, args []string) error {
if showsVersion {
fmt.Println(version.Version)
Expand Down
1 change: 0 additions & 1 deletion cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,4 @@ func serverHandleWithYamux(httpClient *http.Client, headers []piping_tunnel_util
io.CopyBuffer(conn, yamuxStream, buf)
}()
}
return nil
}
2 changes: 1 addition & 1 deletion cmd/socks.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var socksCmd = &cobra.Command{
socks5Conf := &socks5.Config{}
socks5Server, err := socks5.New(socks5Conf)
if err != nil {
panic(err)
return err
}
return socksHandleWithYamux(socks5Server, httpClient, headers, clientToServerUrl, serverToClientUrl)
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func generatePaths(args []string) (string, string, error) {
clientToServerPath = args[0]
serverToClientPath = args[1]
default:
return "", "", fmt.Errorf("The number of paths should be one or two\n")
return "", "", fmt.Errorf("the number of paths should be one or two")
}
return clientToServerPath, serverToClientPath, nil
}
Expand Down
5 changes: 2 additions & 3 deletions io_progress/io_progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
)

type IOProgress struct {
io.ReadWriteCloser
CurrReadBytes uint64
reader io.Reader
writer io.Writer
Expand All @@ -29,8 +28,8 @@ func (progress *IOProgress) Read(p []byte) (int, error) {
if err != nil {
return n, err
}
progress.displayIfShould()
progress.CurrReadBytes += uint64(n)
go progress.displayIfShould()
return n, nil
}

Expand All @@ -40,7 +39,7 @@ func (progress *IOProgress) Write(p []byte) (int, error) {
return n, err
}
progress.CurrWriteBytes += uint64(n)
progress.displayIfShould()
go progress.displayIfShould()
return n, nil
}

Expand Down
4 changes: 2 additions & 2 deletions piping-tunnel-util/duplex.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

type PipingDuplex struct {
downloadReaderChan chan interface{} // io.ReadCloser or error
downloadReaderChan <-chan interface{} // io.ReadCloser or error
uploadWriter *io.PipeWriter
downloadReader io.ReadCloser
}
Expand All @@ -26,7 +26,7 @@ func NewPipingDuplex(httpClient *http.Client, headers []KeyValue, uploadPath, do
return nil, err
}

downloadReaderChan := make(chan interface{}, 1)
downloadReaderChan := make(chan interface{})
go func() {
req, err = http.NewRequest("GET", downloadPath, nil)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package version

const Version = "0.6.0"
const Version = "0.7.0"

0 comments on commit c55f255

Please sign in to comment.