Skip to content

Commit

Permalink
Merge pull request #94 from blacknon/develop
Browse files Browse the repository at this point in the history
Version 0.6.7

Close #86 
Close #91 
Close #92 

- Supported Windows.
- Add Reverse Dynamic Forward.
- Add localrc compress option.
- Addition of function to specify host in target PATH with shell command of lsftp. 
    - example: `get host1,host2:/path/to/src /path/to/dest`
  • Loading branch information
blacknon authored Mar 13, 2022
2 parents 19a8e26 + 3559e34 commit 234964a
Show file tree
Hide file tree
Showing 263 changed files with 17,063 additions and 4,537 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ jobs:
goarch: amd64
os: macos-latest
ext: tar.gz
# - goos: windows
# goarch: amd64
# os: windows-latest
# ext: zip
- goos: windows
goarch: amd64
os: windows-latest
ext: zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
Expand Down Expand Up @@ -78,6 +78,15 @@ jobs:
## tar czvf "$_TAR" -C "$PWD/package" completion bin man .tar2package.yml
tar czvf "$_TAR" -C "$PWD/package" completion bin .tar2package.yml
- name: Create package file(Windows)
if: matrix.ext == 'zip'
run: |
mkdir package/bin
move lssh.${{ matrix.goos }}_${{ matrix.goarch }} package/bin/lssh.exe
move lscp.${{ matrix.goos }}_${{ matrix.goarch }} package/bin/lscp.exe
move lsftp.${{ matrix.goos }}_${{ matrix.goarch }} package/bin/lsftp.exe
powershell Compress-Archive package lssh_${{ steps.package_version.outputs.version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
# use: https://github.com/greymd/tar2package
- name: Build rpm
id: rpm
Expand Down Expand Up @@ -127,6 +136,13 @@ jobs:
name: build-${{ matrix.goos }}_${{ matrix.goarch }}
path: lssh_${{ steps.package_version.outputs.version }}_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz

- name: Upload artifact
if: matrix.ext == 'zip'
uses: actions/upload-artifact@v1
with:
name: build-${{ matrix.goos }}_${{ matrix.goarch }}
path: lssh_${{ steps.package_version.outputs.version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip

# create package release
create-release:
needs:
Expand Down Expand Up @@ -182,6 +198,11 @@ jobs:
goarch: amd64
os: macos-latest
ext: tar.gz
- goos: windows
goarch: amd64
os: windows-latest
ext: zip

needs: [create-release]
runs-on: ubuntu-latest
steps:
Expand Down
55 changes: 45 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,42 @@ Supported multiple ssh proxy, http/socks5 proxy, x11 forward, and port forwardin
## Features

* List selection type ssh client.
* It can run on **Linux**, **macOS** and **Windows**.
* Pure Go.
* Commands can be executed by ssh connection in parallel.
* Supported ssh multiple proxy, http/socks5 proxy.
* Supported ssh-agent.
* Supported Port forward, x11 forward.
* Commands can be executed by ssh connection in **parallel**.
* There is a shell function that connects to multiple hosts in parallel for interactive operation and connects with local commands via pipes.
* Supported multiple proxy, **ssh**, **http**, and **socks5** proxy. It's supported multi-stage proxy.
* Supported **ssh-agent**.
* Supported **Local** and **Remote Port forward**, **Dynamic Forward**, **Reverse Dynamic Forward** and **x11 forward**.
* Can use bashrc of local machine at ssh connection destination.
* It supports various authentication methods. Password, Public key, Certificate and PKCS11(Yubikey etc.).
* Can read the OpenSSH config (~/.ssh/config) and use it as it is.

## Demo

### run MacOSX

<p align="center">
<img src="./images/lssh_macosx.gif" />
</p>

### run Linux(Manjaro)

<p align="center">
<img src="./images/lssh_linux.gif" />
</p>

### run Windows(Windows 10)

<p align="center">
<img src="./images/lssh.gif" />
<img src="./images/lssh_windows.gif" />
</p>

## Install

### compile

compile gofile(tested go1.15.5).
compile gofile(tested go1.17.6).

GO111MODULE=auto go get -u github.com/blacknon/lssh/cmd/lssh
GO111MODULE=auto go get -u github.com/blacknon/lssh/cmd/lscp
Expand Down Expand Up @@ -110,7 +128,7 @@ option(lssh)
blacknon([email protected])

VERSION:
0.6.5
0.6.7

USAGE:
# connect ssh
Expand Down Expand Up @@ -151,7 +169,7 @@ option(lscp)
blacknon([email protected])

VERSION:
0.6.5
0.6.7

USAGE:
# local to remote scp
Expand Down Expand Up @@ -186,7 +204,7 @@ option(lsftp)
blacknon([email protected])

VERSION:
0.6.5
0.6.7

USAGE:
# start lsftp shell
Expand Down Expand Up @@ -219,6 +237,7 @@ You can connect using a local bashrc file (if ssh login shell is bash).
key = "/path/to/private_key"
note = "Use local bashrc files."
local_rc = 'yes'
local_rc_compress = true # gzip compress localrc file data
local_rc_file = [
"~/dotfiles/.bashrc"
,"~/dotfiles/bash_prompt"
Expand Down Expand Up @@ -602,7 +621,7 @@ You can specify from the command line or from the configuration file.
lssh -L 8080:localhost:80 # local port forwarding
lssh -R 80:localhost:8080 # remote port forwarding
lssh -D 10080 # dynamic port forwarding

lssh -R 10080 # Reverse Dynamic port forwarding

#### config file

Expand All @@ -623,6 +642,22 @@ You can specify from the command line or from the configuration file.
port_forward_remote = "localhost:8080"
note = "remote port forwawrd example"

[server.DynamicForward]
addr = "dynamicforward.local"
user = "user"
agentauth = true
dynamic_port_forward = "11080"
note = "dynamic forwawrd example"

[server.ReverseDynamicForward]
addr = "reversedynamicforward.local"
user = "user"
agentauth = true
reverse_dynamic_port_forward = "11080"
note = "reverse dynamic forwawrd example"



If OpenSsh config is loaded, it will be loaded as it is.


Expand Down
4 changes: 4 additions & 0 deletions check/check.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2022 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.

/*
check is a package used mainly for check processing required by lssh, content check of configuration file.
*/
Expand Down
4 changes: 4 additions & 0 deletions check/check_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2022 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.

package check

import (
Expand Down
Empty file removed cmd/lscp/.gitkeep
Empty file.
6 changes: 3 additions & 3 deletions cmd/lscp/args.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Blacknon. All rights reserved.
// Copyright (c) 2022 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.

Expand Down Expand Up @@ -60,7 +60,7 @@ USAGE:
app.Name = "lscp"
app.Usage = "TUI list select and parallel scp client command."
app.Copyright = "blacknon([email protected])"
app.Version = "0.6.6"
app.Version = "0.6.7"

// options
// TODO(blacknon): オプションの追加(0.7.0)
Expand Down Expand Up @@ -114,7 +114,7 @@ USAGE:
check.CheckTypeError(isFromInRemote, isFromInLocal, isToRemote, len(hosts))

// Get config data
data := conf.ReadConf(confpath)
data := conf.Read(confpath)

// Get Server Name List (and sort List)
names := conf.GetNameList(data)
Expand Down
2 changes: 1 addition & 1 deletion cmd/lscp/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Blacknon. All rights reserved.
// Copyright (c) 2022 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.

Expand Down
6 changes: 3 additions & 3 deletions cmd/lsftp/args.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Blacknon. All rights reserved.
// Copyright (c) 2022 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.

Expand Down Expand Up @@ -51,7 +51,7 @@ USAGE:
app.Name = "lsftp"
app.Usage = "TUI list select and parallel sftp client command."
app.Copyright = "blacknon([email protected])"
app.Version = "0.6.6"
app.Version = "0.6.7"

app.Flags = []cli.Flag{
cli.StringFlag{Name: "file,F", Value: defConf, Usage: "config file path"},
Expand All @@ -72,7 +72,7 @@ USAGE:
confpath := c.String("file")

// Get config data
data := conf.ReadConf(confpath)
data := conf.Read(confpath)

// Get Server Name List (and sort List)
names := conf.GetNameList(data)
Expand Down
2 changes: 1 addition & 1 deletion cmd/lsftp/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Blacknon. All rights reserved.
// Copyright (c) 2022 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.

Expand Down
17 changes: 12 additions & 5 deletions cmd/lssh/args.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Blacknon. All rights reserved.
// Copyright (c) 2022 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.

Expand All @@ -10,6 +10,7 @@ import (
"fmt"
"os"
"os/user"
"regexp"
"sort"

"github.com/blacknon/lssh/check"
Expand Down Expand Up @@ -65,7 +66,7 @@ USAGE:
app.Name = "lssh"
app.Usage = "TUI list select and parallel ssh client command."
app.Copyright = "blacknon([email protected])"
app.Version = "0.6.6"
app.Version = "0.6.7"

// TODO(blacknon): オプションの追加
// -f ... バックグラウンドでの接続(X11接続やport forwardingをバックグラウンドで実行する場合など)。
Expand Down Expand Up @@ -116,7 +117,7 @@ USAGE:
confpath := c.String("file")

// Get config data
data := conf.ReadConf(confpath)
data := conf.Read(confpath)

// Set `exec command` or `shell` flag
isMulti := false
Expand Down Expand Up @@ -214,8 +215,14 @@ USAGE:
for _, forwardargs := range c.StringSlice("R") {
f := new(conf.PortForward)
f.Mode = "R"
f.Local, f.Remote, err = common.ParseForwardPort(forwardargs)
forwards = append(forwards, f)

// If only numbers are passed as arguments, treat as Reverse Dynamic Port Forward
if regexp.MustCompile(`^[0-9]+$`).Match([]byte(forwardargs)) {
r.ReverseDynamicPortForward = forwardargs
} else {
f.Local, f.Remote, err = common.ParseForwardPort(forwardargs)
forwards = append(forwards, f)
}
}

// if err
Expand Down
2 changes: 1 addition & 1 deletion cmd/lssh/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Blacknon. All rights reserved.
// Copyright (c) 2022 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.

Expand Down
Loading

0 comments on commit 234964a

Please sign in to comment.