Skip to content
This repository was archived by the owner on Apr 21, 2023. It is now read-only.
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ _testmain.go

# Ignore go.sum
/go.sum
.idea/
dist/
62 changes: 62 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod download
# you may remove this if you don't need go generate
- go generate ./...
builds:
- main: ./cmd/transocks/main.go
env:
- CGO_ENABLED=0
ldflags:
- -X main.VERSION={{.Version}}
goos:
- windows
- darwin
- linux
- freebsd
goarch:
- amd64
- 386
- arm
- arm64
goarm:
- 6
- 7
ignore:
- goos: windows
goarch: arm
- goos: windows
goarch: arm64
- goos: darwin
goarch: arm
- goos: darwin
goarch: arm64
- goos: freebsd
goarch: arm
- goos: freebsd
goarch: arm64
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
format_overrides:
- goos: windows
format: zip
files:
- README*.md
- LICENSE
- ./cmd/transocks/*.toml
snapshot:
name_template: "{{ .Tag }}"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

## [1.1.2] - 2020-03-10

### Added
- Add goreleaser support
- Add version flag for transocks cmd

## [1.1.1] - 2019-03-16

### Changed
Expand Down
8 changes: 8 additions & 0 deletions cmd/transocks/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net"
"net/url"
"os"

"github.com/BurntSushi/toml"
"github.com/cybozu-go/log"
Expand All @@ -23,8 +24,10 @@ const (
)

var (
VERSION = "Unknown"
configFile = flag.String("f", "/etc/transocks.toml",
"TOML configuration file path")
showVersion = flag.Bool("v", false, "show version and exit")
)

func loadConfig() (*transocks.Config, error) {
Expand Down Expand Up @@ -74,6 +77,11 @@ func serve(lns []net.Listener, c *transocks.Config) {
func main() {
flag.Parse()

if *showVersion {
fmt.Println(VERSION)
os.Exit(0)
}

c, err := loadConfig()
if err != nil {
log.ErrorExit(err)
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ require (
golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3
golang.org/x/sys v0.0.0-20180906133057-8cf3aee42992
)

go 1.13