Compare commits

..

6 Commits

5 changed files with 28 additions and 8 deletions

View File

@ -1,3 +1,12 @@
Some examples for API usage in Go for the ssh.surf API Some examples for API usage in Go for the ssh.surf API.
All of them based on .env files All of them based on a .env file.
To install this package you can use the following while you have it setup for a Go project.
```text
go get github.com/joho/godotenv
```
# DISCLAIMER
The binaries may need to be rebuild. As they are build on Ubuntu and it may also depends on how you installed Golang.

BIN
keystatus

Binary file not shown.

View File

@ -61,8 +61,19 @@ func main() {
} }
// Print the response // Print the response
if resp.StatusCode == http.StatusOK {
fmt.Println("") fmt.Println("")
fmt.Println("Key status: Active")
fmt.Println("Key expire fulldate: ", r.KeyexpireString) fmt.Println("Key expire fulldate: ", r.KeyexpireString)
fmt.Println("Key expire date: ", r.ExpireDate) fmt.Println("Key expire date: ", r.ExpireDate)
fmt.Println("") fmt.Println("")
} else if resp.StatusCode == http.StatusUnauthorized {
fmt.Println("")
fmt.Println("Key status: Expired")
fmt.Println("")
} else {
fmt.Println("")
fmt.Println("Recieved an other status code.")
fmt.Println("")
}
} }

BIN
newkey

Binary file not shown.

View File

@ -14,7 +14,7 @@ import (
type Response struct { type Response struct {
Action string `json:"action"` Action string `json:"action"`
Completed string `json:"completed"` Completed string `json:"completed"`
NewAPIKey int `json:"newAPIKey"` NewAPIKey string `json:"newAPIKey"`
} }
func main() { func main() {