Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09fcce6be5 | ||
|
|
cf40e0b6b5 | ||
|
|
fddf51b7bf | ||
|
|
a72f303b68 | ||
|
|
f2607b5b4a | ||
|
|
5f4d044cb0 | ||
|
|
9d5b10625f | ||
|
|
e56baff565 | ||
| d056af8001 | |||
|
|
6ff1142ead | ||
|
|
9725c985f5 | ||
|
|
6db5904a31 | ||
|
|
d4c812f214 | ||
|
|
c4de2f6025 | ||
|
|
b38c70a425 | ||
|
|
a0f4a7a262 | ||
|
|
a3a8f86885 | ||
|
|
e140cc59f5 | ||
|
|
be0d38db70 | ||
|
|
1aba5c038c | ||
|
|
1c5d01a492 | ||
|
|
8332d6240d | ||
|
|
8133bc1058 | ||
|
|
dcfd3098a5 | ||
|
|
e1283d95e8 | ||
|
|
20cbc0cbd4 | ||
|
|
39c839a33d | ||
|
|
ebfbd41801 | ||
|
|
2eaddcb743 | ||
|
|
1ac46c0b22 | ||
|
|
d8480e8946 | ||
| 6c88bbf40a | |||
| c64f489c95 | |||
| 911cfef9e7 | |||
| d38a7e126d | |||
| 858b11ba23 | |||
| f60ffe3525 |
8
.deepsource.toml
Normal file
8
.deepsource.toml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
version = 1
|
||||||
|
|
||||||
|
[[analyzers]]
|
||||||
|
name = "go"
|
||||||
|
enabled = true
|
||||||
|
|
||||||
|
[analyzers.meta]
|
||||||
|
import_root = "github.com/luketainton/iPilot"
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [
|
|
||||||
"config:base"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
58
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
58
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
---
|
||||||
|
name: "Bug Report"
|
||||||
|
description: "Submit a bug report"
|
||||||
|
labels: ["bug"]
|
||||||
|
assignees: ["luketainton"]
|
||||||
|
body:
|
||||||
|
- type: checkboxes
|
||||||
|
id: checks
|
||||||
|
attributes:
|
||||||
|
label: First Check
|
||||||
|
description: Please confirm and check all the following options.
|
||||||
|
options:
|
||||||
|
- label: This is not a feature request
|
||||||
|
required: true
|
||||||
|
- label: I added a descriptive title to this issue.
|
||||||
|
required: true
|
||||||
|
- label: I used the GitHub search to find a similar issue and didn't find one.
|
||||||
|
required: true
|
||||||
|
- type: input
|
||||||
|
id: ipilot-version
|
||||||
|
attributes:
|
||||||
|
label: iPilot Version
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: What is the issue you are experiencing?
|
||||||
|
placeholder: A clear and concise description of what the bug is.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: reproduction
|
||||||
|
attributes:
|
||||||
|
description: If you do not provide a way to reproduce the issue, your issue will likely be closed.
|
||||||
|
label: How can the maintainer reproduce the issue?
|
||||||
|
placeholder: A clear step-by-step guide on how to reproduce the issue.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: dropdown
|
||||||
|
id: os
|
||||||
|
attributes:
|
||||||
|
label: Deployment
|
||||||
|
description: What Deployment system are you using?
|
||||||
|
multiple: true
|
||||||
|
options:
|
||||||
|
- Docker
|
||||||
|
- Native (Windows)
|
||||||
|
- Native (MacOS)
|
||||||
|
- Native (Linux)
|
||||||
|
- Other
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: os-details
|
||||||
|
attributes:
|
||||||
|
label: Deployment Details
|
||||||
|
description: You can add more details about your operating system here, in particular if you chose "Other".
|
||||||
@@ -26,7 +26,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [prepare-data]
|
needs: [prepare-data]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||||
- name: Login to GitHub Package Registry
|
- name: Login to GitHub Package Registry
|
||||||
run: echo ${{ secrets.PAT }} | docker login ghcr.io -u luketainton --password-stdin
|
run: echo ${{ secrets.PAT }} | docker login ghcr.io -u luketainton --password-stdin
|
||||||
- name: Build image for GitHub Package Registry
|
- name: Build image for GitHub Package Registry
|
||||||
@@ -41,7 +41,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [prepare-data]
|
needs: [prepare-data]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||||
- name: Build artifacts
|
- name: Build artifacts
|
||||||
run: |
|
run: |
|
||||||
docker run --rm -w /go/src/app -v ${PWD}:/go/src/app -e CGO_ENABLED=0 -e GOARCH=amd64 -e GOOS=darwin golang:alpine go build -o /go/src/app/${{ needs.prepare-data.outputs.repo }}-${{ needs.prepare-data.outputs.tag }}-darwin-amd64
|
docker run --rm -w /go/src/app -v ${PWD}:/go/src/app -e CGO_ENABLED=0 -e GOARCH=amd64 -e GOOS=darwin golang:alpine go build -o /go/src/app/${{ needs.prepare-data.outputs.repo }}-${{ needs.prepare-data.outputs.tag }}-darwin-amd64
|
||||||
70
.github/workflows/codeql-analysis.yml
vendored
Normal file
70
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
# For most projects, this workflow file will not need changing; you simply need
|
||||||
|
# to commit it to your repository.
|
||||||
|
#
|
||||||
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
|
# or to provide custom queries or build logic.
|
||||||
|
#
|
||||||
|
# ******** NOTE ********
|
||||||
|
# We have attempted to detect the languages in your repository. Please check
|
||||||
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
|
# supported CodeQL languages.
|
||||||
|
#
|
||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ main ]
|
||||||
|
schedule:
|
||||||
|
- cron: '18 1 * * 1'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'go' ]
|
||||||
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||||
|
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v3
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
# By default, queries listed here will override any specified in a config file.
|
||||||
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v3
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
||||||
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
|
# and modify them (or add more) to build your code if your project
|
||||||
|
# uses a compiled language
|
||||||
|
|
||||||
|
#- run: |
|
||||||
|
# make bootstrap
|
||||||
|
# make release
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v3
|
||||||
42
.github/workflows/test.yml
vendored
Normal file
42
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
name: Test
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: 1.19
|
||||||
|
- name: Create golangci-lint report
|
||||||
|
run: |
|
||||||
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.42.1
|
||||||
|
$(go env GOPATH)/bin/golangci-lint run --out-format checkstyle -D deadcode,unused --build-tags=integration --timeout 10m --issues-exit-code 0 ./... > report.xml
|
||||||
|
sed -i 's+<file name="+<file name="go/+g' report.xml
|
||||||
|
cat report.xml
|
||||||
|
- name: Test
|
||||||
|
run: go test -short -coverprofile=coverage.out
|
||||||
|
continue-on-error: true
|
||||||
|
- name: SonarCloud Scan
|
||||||
|
uses: SonarSource/sonarcloud-github-action@master
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_CLOUD }}
|
||||||
|
# - uses: sonarsource/sonarqube-scan-action@master
|
||||||
|
# env:
|
||||||
|
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
# SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||||
|
# - uses: sonarsource/sonarqube-quality-gate-action@master
|
||||||
|
# timeout-minutes: 5
|
||||||
|
# env:
|
||||||
|
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/.vscode
|
||||||
|
/.idea
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
stages:
|
|
||||||
- build
|
|
||||||
- upload
|
|
||||||
- release
|
|
||||||
|
|
||||||
build-docker:
|
|
||||||
stage: build
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
image: docker:19.03.12
|
|
||||||
services:
|
|
||||||
- docker:19.03.12-dind
|
|
||||||
variables:
|
|
||||||
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
|
||||||
script:
|
|
||||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
|
||||||
- docker build -t $CI_REGISTRY_IMAGE:latest -t $IMAGE_TAG .
|
|
||||||
- docker build -t $IMAGE_TAG -t $CI_REGISTRY_IMAGE:latest .
|
|
||||||
- docker push $IMAGE_TAG
|
|
||||||
- docker push $CI_REGISTRY_IMAGE:latest
|
|
||||||
|
|
||||||
build-binary:
|
|
||||||
stage: build
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
image: golang:1.17.3
|
|
||||||
before_script:
|
|
||||||
- cd $GOPATH/src
|
|
||||||
- mkdir -p gitlab.com/$CI_PROJECT_NAMESPACE
|
|
||||||
- cd gitlab.com/$CI_PROJECT_NAMESPACE
|
|
||||||
- ln -s $CI_PROJECT_DIR
|
|
||||||
- cd $CI_PROJECT_NAME
|
|
||||||
script:
|
|
||||||
- CGO_ENABLED=0 GOARCH=amd64 GOOS=darwin go build -o bin/iPilot-${CI_COMMIT_TAG}-darwin-amd64
|
|
||||||
- CGO_ENABLED=0 GOARCH=arm64 GOOS=darwin go build -o bin/iPilot-${CI_COMMIT_TAG}-darwin-arm64
|
|
||||||
- CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -o bin/iPilot-${CI_COMMIT_TAG}-linux-amd64
|
|
||||||
- CGO_ENABLED=0 GOARCH=amd64 GOOS=windows go build -o bin/iPilot-${CI_COMMIT_TAG}-win-amd64.exe
|
|
||||||
- CGO_ENABLED=0 GOARCH=386 GOOS=windows go build -o bin/iPilot-${CI_COMMIT_TAG}-win-x86.exe
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- bin/
|
|
||||||
|
|
||||||
upload:
|
|
||||||
stage: upload
|
|
||||||
image: curlimages/curl:latest
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG
|
|
||||||
dependencies:
|
|
||||||
- build-binary
|
|
||||||
before_script:
|
|
||||||
- ls
|
|
||||||
- pwd
|
|
||||||
script:
|
|
||||||
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file bin/iPilot-${CI_COMMIT_TAG}-darwin-amd64 "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/iPilot/${CI_COMMIT_TAG}/iPilot-${CI_COMMIT_TAG}-darwin-amd64"'
|
|
||||||
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file bin/iPilot-${CI_COMMIT_TAG}-darwin-arm64 "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/iPilot/${CI_COMMIT_TAG}/iPilot-${CI_COMMIT_TAG}-darwin-arm64"'
|
|
||||||
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file bin/iPilot-${CI_COMMIT_TAG}-linux-amd64 "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/iPilot/${CI_COMMIT_TAG}/iPilot-${CI_COMMIT_TAG}-linux-amd64"'
|
|
||||||
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file bin/iPilot-${CI_COMMIT_TAG}-win-amd64.exe "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/iPilot/${CI_COMMIT_TAG}/iPilot-${CI_COMMIT_TAG}-win-amd64.exe"'
|
|
||||||
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file bin/iPilot-${CI_COMMIT_TAG}-win-x86.exe "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/iPilot/${CI_COMMIT_TAG}/iPilot-${CI_COMMIT_TAG}-win-x86.exe"'
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
image: registry.gitlab.com/gitlab-org/release-cli:v0.4.0
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG
|
|
||||||
script:
|
|
||||||
- |
|
|
||||||
release-cli create --name "$CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
|
|
||||||
--assets-link "{\"name\":\"iPilot-${CI_COMMIT_TAG}-darwin-amd64\",\"url\":\"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/iPilot/${CI_COMMIT_TAG}/iPilot-${CI_COMMIT_TAG}-darwin-amd64\"}" \
|
|
||||||
--assets-link "{\"name\":\"iPilot-${CI_COMMIT_TAG}-darwin-arm64\",\"url\":\"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/iPilot/${CI_COMMIT_TAG}/iPilot-${CI_COMMIT_TAG}-darwin-arm64\"}" \
|
|
||||||
--assets-link "{\"name\":\"iPilot-${CI_COMMIT_TAG}-linux-amd64\",\"url\":\"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/iPilot/${CI_COMMIT_TAG}/iPilot-${CI_COMMIT_TAG}-linux-amd64\"}" \
|
|
||||||
--assets-link "{\"name\":\"iPilot-${CI_COMMIT_TAG}-win-amd64.exe\",\"url\":\"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/iPilot/${CI_COMMIT_TAG}/iPilot-${CI_COMMIT_TAG}-win-amd64.exe\"}" \
|
|
||||||
--assets-link "{\"name\":\"iPilot-${CI_COMMIT_TAG}-win-x86.exe\",\"url\":\"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/iPilot/${CI_COMMIT_TAG}/iPilot-${CI_COMMIT_TAG}-win-x86.exe\"}"
|
|
||||||
11
API.go
11
API.go
@@ -19,15 +19,12 @@ func getLocalIP() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
body, _ := ioutil.ReadAll(resp.Body)
|
body, _ := ioutil.ReadAll(resp.Body)
|
||||||
return string(body[:])
|
return string(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkIPSyntax(ipaddress string) bool {
|
func isIPAddress(ipaddress string) bool {
|
||||||
addr := net.ParseIP(ipaddress)
|
addr := net.ParseIP(ipaddress)
|
||||||
if addr == nil {
|
return addr != nil
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func resolveDNSHostname(hostname string) string {
|
func resolveDNSHostname(hostname string) string {
|
||||||
@@ -53,7 +50,7 @@ func getIPInfo(ipaddress string) IPAddressInfo {
|
|||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
func getBGPPrefixes(as string) {
|
func printBGPPrefixes(as string) {
|
||||||
apiEndpoint := "https://api.hackertarget.com/aslookup/?q=" + as
|
apiEndpoint := "https://api.hackertarget.com/aslookup/?q=" + as
|
||||||
resp, err := http.Get(apiEndpoint)
|
resp, err := http.Get(apiEndpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.17-alpine as build
|
FROM golang:1.21-alpine as build
|
||||||
WORKDIR /go/src/app
|
WORKDIR /go/src/app
|
||||||
COPY . /go/src/app
|
COPY . /go/src/app
|
||||||
RUN CGO_ENABLED=0 go build -o /go/bin/app
|
RUN CGO_ENABLED=0 go build -o /go/bin/app
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ func printIPInfo(input string, wantPrefixes bool) {
|
|||||||
fmt.Println("Timezone: ", IPInfo.Timezone)
|
fmt.Println("Timezone: ", IPInfo.Timezone)
|
||||||
fmt.Println("ISP: ", IPInfo.ISP)
|
fmt.Println("ISP: ", IPInfo.ISP)
|
||||||
fmt.Println("BGP AS: ", bgpAS)
|
fmt.Println("BGP AS: ", bgpAS)
|
||||||
if wantPrefixes == true {
|
if wantPrefixes {
|
||||||
fmt.Println("\nBGP Prefixes:")
|
fmt.Println("\nBGP Prefixes:")
|
||||||
getBGPPrefixes(bgpAS)
|
printBGPPrefixes(bgpAS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2021 Luke Tainton
|
Copyright (c) 2022 Luke Tainton
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
9
Main.go
9
Main.go
@@ -33,22 +33,21 @@ func main() {
|
|||||||
if input == "" {
|
if input == "" {
|
||||||
fmt.Println("FATAL: No IP address or domain name was specified.")
|
fmt.Println("FATAL: No IP address or domain name was specified.")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
} else {
|
}
|
||||||
|
|
||||||
if input == "me" {
|
if input == "me" {
|
||||||
input = getLocalIP()
|
input = getLocalIP()
|
||||||
}
|
}
|
||||||
var isIPCorrect bool = checkIPSyntax(input)
|
if isIPAddress(input) {
|
||||||
if isIPCorrect == true {
|
|
||||||
printIPInfo(input, wantPrefixes)
|
printIPInfo(input, wantPrefixes)
|
||||||
} else {
|
} else {
|
||||||
ipaddress := resolveDNSHostname(input)
|
ipaddress := resolveDNSHostname(input)
|
||||||
if checkIPSyntax(ipaddress) == true {
|
if isIPAddress(ipaddress) {
|
||||||
fmt.Println("Domain Name: ", input)
|
fmt.Println("Domain Name: ", input)
|
||||||
printIPInfo(ipaddress, wantPrefixes)
|
printIPInfo(ipaddress, wantPrefixes)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Invalid query.")
|
fmt.Println("Invalid query.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,3 +1,3 @@
|
|||||||
module github.com/luketainton/iPilot
|
module github.com/luketainton/iPilot
|
||||||
|
|
||||||
go 1.16
|
go 1.19
|
||||||
|
|||||||
29
ipilot_test.go
Normal file
29
ipilot_test.go
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestGetCurrentIP(t *testing.T) {
|
||||||
|
myip := getLocalIP()
|
||||||
|
if myip == "" {
|
||||||
|
t.Log("could not retrieve current IP")
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestIsIPAddress(t *testing.T) {
|
||||||
|
ipaddress := "192.168.0.1"
|
||||||
|
isIP := isIPAddress(ipaddress)
|
||||||
|
if isIP == false {
|
||||||
|
t.Log("could not verify " + ipaddress + " is an IP address")
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestResolveDNSHostname(t *testing.T) {
|
||||||
|
hostname := "one.one.one.one"
|
||||||
|
ipaddress := resolveDNSHostname(hostname)
|
||||||
|
if ipaddress != "1.1.1.1" {
|
||||||
|
t.Log("could not resolve IP for " + hostname)
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
16
renovate.json
Normal file
16
renovate.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"extends": ["config:base"],
|
||||||
|
"platformCommit": true,
|
||||||
|
"dependencyDashboardAutoclose": true,
|
||||||
|
"assignAutomerge": true,
|
||||||
|
"assigneesFromCodeOwners": true,
|
||||||
|
"rebaseWhen": "behind-base-branch",
|
||||||
|
"rollbackPrs": true,
|
||||||
|
"labels": ["dependencies"],
|
||||||
|
"vulnerabilityAlerts": {
|
||||||
|
"enabled": true,
|
||||||
|
"labels": ["security"],
|
||||||
|
"commitMessagePrefix": "[SECURITY] ",
|
||||||
|
"prCreation": "immediate"
|
||||||
|
}
|
||||||
|
}
|
||||||
11
sonar-project.properties
Normal file
11
sonar-project.properties
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
sonar.organization=luketainton
|
||||||
|
sonar.projectKey=luketainton_iPilot
|
||||||
|
# sonar.projectKey=luketainton_iPilot_AYKYmHI397IDIMpeRtF7
|
||||||
|
sonar.projectName=iPilot
|
||||||
|
sonar.projectVersion=1.3.9
|
||||||
|
sonar.sources=.
|
||||||
|
sonar.exclusions=,.github/**,.gitignore,CODEOWNERS,CHANGELOG.md,LICENSE.md,README.md,renovate.json,**/*_test.go
|
||||||
|
sonar.tests=.
|
||||||
|
sonar.test.inclusions=**/*_test.go
|
||||||
|
sonar.go.golangci-lint.reportPaths=report.xml
|
||||||
|
sonar.go.coverage.reportPaths=coverage.out
|
||||||
Reference in New Issue
Block a user