diff --git a/CHANGELOG.md b/CHANGELOG.md index bfad679..b7cdc7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [0.0.3] + +- Update core modules +- Set default cores to all available minus 1 + + ## [0.0.2] - Show duration estimate for weeks, months and years @@ -7,4 +13,4 @@ ## [0.0.1] -- First release \ No newline at end of file +- First release diff --git a/Makefile b/Makefile index 48ef3a3..2adfdab 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ VERSION ?= `[ -d ".git" ] && git describe --tags || echo "0.0.0"` LDFLAGS=-ldflags "-s -w -X main.appVersion=${VERSION}" BINARY="wireguard-vanity-keygen" -build = echo "\n\nBuilding $(1)-$(2)" && GOOS=$(1) GOARCH=$(2) go build ${LDFLAGS} -o dist/${BINARY}_${VERSION}_$(1)_$(2) \ +build = echo "\n\nBuilding $(1)-$(2)" && GO386=softfloat GOOS=$(1) GOARCH=$(2) go build ${LDFLAGS} -o dist/${BINARY}_${VERSION}_$(1)_$(2) \ && bzip2 dist/${BINARY}_${VERSION}_$(1)_$(2) \ && if [ $(1) = "windows" ]; then mv dist/${BINARY}_${VERSION}_$(1)_$(2).bz2 dist/${BINARY}_${VERSION}_$(1)_$(2).exe.bz2; fi @@ -21,7 +21,7 @@ release: $(call build,linux,386) $(call build,linux,arm) $(call build,linux,arm64) + $(call build,darwin,arm64) $(call build,darwin,amd64) - $(call build,darwin,386) $(call build,windows,386) $(call build,windows,amd64) diff --git a/README.md b/README.md index 9481606..b60d469 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ A command-line vanity (public) key generator for [WireGuard](https://www.wiregua - Optional case sensitive searching - Search multiple prefixes at once - Exit after results limit reached (defaults to 1) -- Displays probablibilty and estimated runtime based on quick benchmark +- Displays probability and estimated runtime based on quick benchmark ## Usage options @@ -22,7 +22,7 @@ Usage: wireguard-vanity-keygen [OPTIONS] [...] Options: -c, --case-sensitive case sensitive match (default false) - -t, --threads int threads (default 4) + -t, --threads int threads (defaults to all available cores minus 1) -l, --limit int limit results to n (exists after) (default 1) ``` @@ -51,7 +51,7 @@ private 8IdcNsman/ZRGvqWzw1e5cRfhhdtAAmk02X9TkQxhHI= public pC1/N8coOcXmcwO09Q ## Installing Download the [latest binary release](https://github.com/axllent/wireguard-vanity-keygen/releases/latest) for your system, -or build from source `go get -u github.com/axllent/wireguard-vanity-keygen`(go >= 1.11 required) +or build from source `go install github.com/axllent/wireguard-vanity-keygen`. ## FAQ @@ -68,9 +68,9 @@ With case-insensitive searches (default), a-z have the chance of matching both u ### How accurate are the estimated times? -They are not and cannot be accurate. Keys are completely randomly generated, and the estimate is based on a law of averages. For instance, you could find a match for a one in a billion chance on the very first hit, or it could take you 5 billion attempts. It will however give you an indication based on word count, case sensitivity, and use of numbers or characters. +They are not (and cannot be) accurate. Keys are completely randomly generated, and the estimate is based on a law of averages. For instance, you could find a match for a one in a billion chance on the very first hit, or it could take you 5 billion attempts. It will however give you an indication based on your CPU speed, word count, case sensitivity, and use of numbers or characters. ### Why do I need this? -You don't. I wrote it because I run a WireGuard server, which does not provide any reference as to who the key belongs to (`wg` on the server). Using vanity keys, I can at least identify connections. I also wanted to learn more about multi-coe processing in Golang. +You don't. I wrote it because I run a WireGuard server, which does not provide any reference as to who the key belongs to (`wg` on the server). Using vanity keys, I can at least identify connections. I also wanted to learn more about multi-core processing in Golang. diff --git a/go.mod b/go.mod index 3bd1e14..022b9e8 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/axllent/wireguard-vanity-keygen -go 1.14 +go 1.17 require ( github.com/spf13/pflag v1.0.5 - golang.org/x/crypto v0.0.0-20200406173513-056763e48d71 + golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce ) diff --git a/go.sum b/go.sum index 665aa15..301387a 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,11 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200406173513-056763e48d71 h1:DOmugCavvUtnUD114C1Wh+UgTgQZ4pMLzXxi1pSt+/Y= -golang.org/x/crypto v0.0.0-20200406173513-056763e48d71/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce h1:Roh6XWxHFKrPgC/EQhVubSAGQ6Ozk6IdxHSzt1mR0EI= +golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/main.go b/main.go index 77d1a76..982c8fe 100644 --- a/main.go +++ b/main.go @@ -22,7 +22,12 @@ func main() { var userCores int flag := pflag.NewFlagSet(os.Args[0], pflag.ExitOnError) - cores := runtime.NumCPU() + // detect number of cores minus one + cores := runtime.NumCPU() - 1 + if cores == 0 { + // if it is single-code then it + cores = 1 + } // set the default help flag.Usage = func() {