Setup
Setting up the database
- Install the Go pq driver
$ go get -u github.com/lib/pq
- Start a CockroachDB local cluster
$ cockroach start --insecure --listen-addr=localhost:26257 --http-addr=localhost:8080
- Initialize the built-in SQL shell:
$ cockroach sql --insecure
- In the SQL shell run:
- CREATE DATABASE servers_project;
- SET database = servers_project;
- CREATE TABLE "domains" ( "name" STRING(100), "servers_changed" STRING(5), "ssl_grade" STRING(2), "previous_ssl_grade" STRING(2), "logo" STRING(150), "title" STRING(150), "is_down" STRING(5), "time" INT, PRIMARY KEY ("name") );
- CREATE TABLE "endpoints" ( "name" STRING(100), "ip_address" STRING(100), "grade" STRING(2), "country" STRING(30), "owner" STRING(100), PRIMARY KEY ("ip_address"), FOREIGN KEY ("name") REFERENCES "domains"("name") );
Setting up the servers
- In your terminal, go to the backend subfolder and install all Go dependencies by running
$ go get -d ./...
- Start the server by running
$ go run server.go database.go domain.go
Setting up Vue
- On another terminal window, go to the frontend/api subfolder and run
$ npm install
- Start the app by running
$ npm run serve
- Go to http://localhost:8081/
Notes/Future Changes
- The golang library fasthttp cannot handle get requests with really large headers. Thus, if you try to access a website with large headers, the package will crash
- When trying to get the owner of an IPAddress, I am using the GoLang package "WHois." This package will sometimes return results that do not list the owner. A possible fix would be using a system call instead, finding an alternative package, or calling an external API.
- Some websites return encrypted results to a Get request. I.E amazon.com (If using the fasthttp package)
- If website is down or does not exist, the program returns a warning that asks the user to input another website. However, server must be restarted
- Fasthhtp package can randomly through TCP dialing timeout errors.