Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
elijahcruz12 committed Jun 16, 2021
0 parents commit 4b3fbb8
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 0 deletions.
Empty file added .gitignore
Empty file.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Up

## The simple terminal package that allows you to check if you can connect to the internet.

# About

This is a simple package that just tests the ability to connect to [Example.com](http://example.com). If it doesn't is tells you that your internet is down, if it works it will say it works.

# Installation

## Windows

Installing is very simple, if your using windows, just download the required .exe file and run it from the command prompt.

Another way to run this script on windows, is an installation of WSL. Follow linux steps if you will install using a WSL Terminal

## Linux

39 changes: 39 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

package="main.go"

package_name="up"

if [[ -z "$package" ]]; then
echo "usage: $0 <package-name>"
exit 1
fi

platforms=("windows/amd64" "windows/386" "darwin/amd64" "linux/amd64" "linux/386" "linux/arm64" "linux/arm")

for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })

GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}

output_name=$package_name'-'$GOOS'-'$GOARCH

output_folder="build/"

output_total=$output_folder$output_name

if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi

echo "Building for ${GOOS} with arch ${GOARCH}"

env GOOS=$GOOS GOARCH=$GOARCH go build -o $output_total $package

echo "Completed building ${output_name}"

done

echo "All builds complete"
Binary file added build/up-darwin-amd64
Binary file not shown.
Binary file added build/up-linux-386
Binary file not shown.
Binary file added build/up-linux-amd64
Binary file not shown.
Binary file added build/up-linux-arm
Binary file not shown.
Binary file added build/up-linux-arm64
Binary file not shown.
Binary file added build/up-windows-386
Binary file not shown.
Binary file added build/up-windows-amd64
Binary file not shown.
21 changes: 21 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package main

import (
"fmt"
"net/http"
)

func main() {
fmt.Println("Testing your internet connection")

resp, err := http.Get("http://example.com")

_ = resp

if err != nil {
fmt.Println("Internet is down")
} else {
fmt.Println("Internet is working")

}
}

0 comments on commit 4b3fbb8

Please sign in to comment.