Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI

on:
push:
branches: [master, dev]
pull_request:
branches: [master, dev]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'

- name: golangci-lint
uses: golangci/golangci-lint-action@v7
with:
version: latest

test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'

- name: Run Tests
run: go test -race -coverprofile=coverage.out ./...

- name: Check Coverage
run: |
echo "=== Overall coverage ==="
TOTAL=$(go tool cover -func=coverage.out | grep '^total:' | awk '{print $3}')
echo "Total: ${TOTAL}"
NUM=$(echo "$TOTAL" | sed 's/%//')
if [ "$(echo "$NUM < 80" | bc -l)" -eq 1 ]; then
echo "FAIL: Total coverage ${TOTAL} is below 80%"
exit 1
fi
echo "PASS: Total coverage ${TOTAL} meets 80% threshold"

vet:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'

- name: Vet
run: go vet ./...

- name: Vulnerability Check
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
5 changes: 4 additions & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
go-version: '1.25'

- name: Run Tests
run: go test -race ./...

- name: Make All
run: make multi VERSION="${{ github.ref_name }}"
Expand Down
45 changes: 42 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
# Binaries
tryssh
/dist/

# Go build cache and test artifacts
*.exe
*.exe~
*.dll
*.so
*.dylib
*.test
*.out
coverage.out
coverage.html

# Go vendor directory
vendor/

# Dependency directories
release/
.idea
.git
tryssh

# IDE / Editor
.idea/
.vscode/
*.swp
*.swo
*~

# OS files
.DS_Store
Thumbs.db

# Claude Code
.claude/

# OpenSpec (development artifacts, not release)
openspec/

# goreleaser dist
dist/

# Temporary files
*.tmp
*.bak
24 changes: 24 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: "2"

linters:
enable:
- errcheck
- govet
- staticcheck
- unused
- ineffassign
- gocritic
- gosec
- revive
exclusions:
rules:
- path: _test\.go
linters:
- gosec
- errcheck
- path: testutil/
linters:
- gosec

run:
timeout: 5m
43 changes: 43 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Contributing to tryssh

## Development Setup

1. Install Go 1.25 or later
2. Install golangci-lint: `go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest`
3. Fork and clone the repository
4. Create a feature branch from `dev`

## Development Workflow

1. Make your changes
2. Run tests: `make test`
3. Run linter: `make lint`
4. Ensure all tests pass and coverage is maintained
5. Commit with descriptive messages
6. Push and create a PR targeting `dev`

## Code Standards

- Follow standard Go formatting (`gofmt`)
- All exported symbols must have godoc comments
- Error handling: return errors, don't use `log.Fatalf` outside `cmd/`
- No global mutable state; use dependency injection
- Write unit tests for all new code

## Commit Messages

Use concise, descriptive commit messages. Prefix with type:

- `Add:` New features
- `Fix:` Bug fixes
- `Upd:` Updates and improvements
- `Refactor:` Code restructuring
- `Test:` Test additions or changes
- `Docs:` Documentation updates

## Pull Request Process

1. Ensure CI passes (lint + test)
2. Maintain test coverage
3. Update documentation if needed
4. Request review from maintainers
18 changes: 17 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ endif
BINARY_VERSION ?= $(GIT_TAG)

ifeq ($(BINARY_VERSION),)
# If cannot find any information that can be used as a version number, change it to debug
BINARY_VERSION := "debug"
endif

Expand All @@ -39,6 +38,23 @@ clean:
@rm -f ./$(BIN_NAME)
@rm -rf ./release

.PHONY: test
test:
@go test -race -v ./...

.PHONY: coverage
coverage:
@go test -race -coverprofile=coverage.out ./...
@go tool cover -func=coverage.out

.PHONY: lint
lint:
@golangci-lint run ./...

.PHONY: vet
vet:
@go vet ./...

.PHONY: multi
multi: tidy
@$(foreach n, $(OS_ARCH_LIST),\
Expand Down
59 changes: 45 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,41 @@ Of course, it can also manage the usernames, port numbers, passwords, and cached
* I frequently use SSH terminal across multiple operating systems, but I haven't found a tool that allows me to maintain the same workflow across different OSes
* I haven't used `tryssh` before, but it looks good, and I want to give it a try

## Current development status
## Requirements

Currently, `tryssh` is in the stage of feature completion. The core functionalities are already implemented, but there is room for improvement in terms of details, particularly in areas such as security.
- Go 1.25 or later

Currently, only one person *Driver-C* is involved in the development, and the progress is limited by the need to allocate time from other work responsibilities. Therefore, the development progress is not expected to be fast.
## Development

If you encounter any usage issues or have any suggestions, please submit an `issue`. We will respond as soon as possible.
### Build

Currently, the project only maintains the `master` branch for releasing stable versions, and `tags` are created from the `master` branch as well.
```bash
make
```

### Test

```bash
make test
```

## TODO list
### Lint

Rankings do not differentiate priority levels. Delete the corresponding entry after completion of the following content.
```bash
make lint
```

1. File transfer supports wildcards
2. Completing unit test code
3. Security-related features, such as encrypting configuration files, hiding sensitive information from plain text display, and switching to interactive password input
### Coverage

```bash
make coverage
```

### Cross-compilation

```bash
make multi
```

## Quick Start

Expand All @@ -46,8 +64,8 @@ tryssh create users testuser
# Create an alternative port number 22
tryssh create ports 22

# Create an alternative password
tryssh create passwords 123456
# Create an alternative password (interactive prompt)
tryssh create passwords

# Attempt to log in to 192.168.1.1 using the information created above
tryssh ssh 192.168.1.1
Expand Down Expand Up @@ -125,8 +143,8 @@ tryssh create users testuser
# Create an alternative port: 22
tryssh create ports 22

# Create an alternative passwords: 123456
tryssh create passwords 123456
# Create an alternative password (interactive prompt)
tryssh create passwords
```

### Command: delete
Expand Down Expand Up @@ -369,4 +387,17 @@ tryssh scp -r 192.168.1.1:/root/testDir ~/Downloads/

# Upload testDir directory to 192.168.1.1 and rename it to testDir2 and place it under /root/
tryssh scp -r ~/Downloads/testDir 192.168.1.1:/root/testDir2

# Upload all .txt files to 192.168.1.1:/root/ (wildcard support)
tryssh scp ./*.txt 192.168.1.1:/root/

# Download all .log files from remote (wildcard support)
tryssh scp 192.168.1.1:/var/log/*.log ./
```

## Security

- **Interactive password input**: Passwords are entered via interactive terminal prompts (never exposed in shell history)
- **Sensitive info masking**: Passwords and keys are masked in `get` output and logs
- **Config encryption**: Set the `TRYSSH_MASTER_KEY` environment variable to enable AES-GCM encryption for stored passwords
- **File permissions**: Config files and directories use restrictive permissions (0600/0700)
Loading
Loading