-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5070c81
Showing
27 changed files
with
2,099 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
custom: ["https://paypal.me/dw1s", "https://saweria.co/dwisiswant0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
name: Dependencies | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build | ||
run: go build . | ||
working-directory: ./ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Release | ||
on: | ||
create: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Check out code" | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: "Set up Go" | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: "Create release on GitHub" | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
args: "release --rm-dist" | ||
version: latest | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.RELEASE_TOKEN }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Update DB | ||
on: | ||
schedule: | ||
- cron: "0 0 * * 0" # at 00:00 on Sunday | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Install dependencies" | ||
run: sudo apt install curl -y | ||
|
||
- name: "Check for updates" | ||
run: | | ||
if [[ "$(curl -skL ${{ secrets.LOCAL_DB }} | wc -l)" == "$(curl -skL ${{ secrets.REMOTE_DB }} | wc -l)" ]]; then | ||
echo "::set-output name=isUpdated::true" | ||
else | ||
echo "::set-output name=isUpdated::false" | ||
fi | ||
echo "::set-output name=date::$(date)" | ||
- name: "Check out code" | ||
if: steps.check.isUpdated == 'false' | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: "Update DB..." | ||
run: curl -kLo db/tlds.txt ${{ secrets.REMOTE_DB }} | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
body: "Automated update TLDs data." | ||
branch-suffix: "short-commit-hash" | ||
branch: "update/db" | ||
commit-message: "db: Update DB ${{ steps.check.date }}" | ||
committer: "Dwi Siswanto <me@dw1.io>" | ||
delete-branch: true | ||
reviewers: "dwisiswant0" | ||
title: "db: Update DB ${{ steps.check.date }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tlder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
builds: | ||
- binary: tlder | ||
main: . | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- 386 | ||
- arm | ||
- arm64 | ||
|
||
archives: | ||
- id: tgz | ||
format: tar.gz | ||
replacements: | ||
darwin: macOS | ||
format_overrides: | ||
- goos: windows | ||
format: zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Dwi Siswanto | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# TLD:er | ||
|
||
TLDs finder — check domain name availability across all valid top-level domains. | ||
|
||
## Installation | ||
|
||
- Get pre-built binary from [releases page](https://github.com/dwisiswant0/tlder/releases), or | ||
- If you have [Go1.17+](https://go.dev/dl/) compiler installed & configured: `go install github.com/dwisiswant0/tlder@latest`. | ||
|
||
## Usage | ||
|
||
```console | ||
> tlder -h | ||
________ ___ | ||
/_ __/ / / _ \___ ____ | ||
/ / / /_/ // / -_) __/ | ||
/_/ /___/____/\__/_/ | ||
--- | ||
@dwisiswant0 | ||
|
||
|
||
Usage: | ||
tlder -d NAME | ||
|
||
Options: | ||
-d, --domain <NAME> Domain NAME to permutate | ||
-s, --silent Silent mode | ||
--unreg Show unregistered TLDs only | ||
``` | ||
|
||
## Data | ||
|
||
TLDs data taken from [data.iana.org](https://data.iana.org/TLD/). Checks for data updates are carried out weekly by [GitHub workflow](https://github.com/dwisiswant0/tlder/actions/workflows/update.yaml). | ||
|
||
## Library | ||
|
||
You can use **TLDer** as library. For example: | ||
|
||
```go | ||
package main | ||
|
||
import "github.com/dwisiswant0/tlder" | ||
|
||
func main() { | ||
name := "dw1" | ||
ext := "io" | ||
|
||
avail, err := tlder.IsAvailable(name, ext) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
print(avail) | ||
} | ||
``` | ||
|
||
## License | ||
|
||
**tlder** is distributed under MIT, contributions are welcome! See `LICENSE`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package main | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/dwisiswant0/tlder/fingerprint" | ||
) | ||
|
||
// IsAvailable domain check from whois response with predefined fingerprint | ||
func IsAvailable(domain string, extension string) (bool, error) { | ||
var s bool | ||
|
||
resp, err := whoIs(domain, extension) | ||
if err != nil { | ||
return s, err | ||
} | ||
|
||
if len([]byte(resp)) == 0 { | ||
return s, errNoResponses | ||
} | ||
|
||
if strings.Contains(resp, "RATE LIMIT EXCEEDED") { | ||
return s, errRateLimited | ||
} | ||
|
||
a := sliceContains(strings.ToLower(resp), fingerprint.Available) | ||
u := sliceContains(resp, fingerprint.Unregistered) | ||
// r := sliceContains(resp, fingerprint.Registered) | ||
|
||
if a || u { | ||
return !s, nil | ||
} | ||
|
||
return s, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package main | ||
|
||
const ( | ||
banner = ` | ||
________ ___ | ||
/_ __/ / / _ \___ ____ | ||
/ / / /_/ // / -_) __/ | ||
/_/ /___/____/\__/_/ ` | ||
author = "@dwisiswant0" | ||
usage = ` | ||
Usage: | ||
tlder -d NAME | ||
Options: | ||
-d, --domain <NAME> Domain NAME to permutate | ||
-s, --silent Silent mode | ||
--unreg Show unregistered TLDs only` | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package db | ||
|
||
import "strings" | ||
|
||
func init() { | ||
List = strings.Split(tlds, "\n") | ||
List = List[1 : len(List)-1] | ||
} |
Oops, something went wrong.