Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
Signed-off-by: QuentinN42 <[email protected]>
  • Loading branch information
QuentinN42 committed Aug 16, 2023
1 parent 9eaab47 commit b6a71e1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ go.work
go-proxy
main
dist
.vscode
.idea
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
go.work
go-proxy
main
.vscode
.idea
10 changes: 5 additions & 5 deletions cmd/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ func main() {
if len(port) == 0 {
port = "8080"
}
if ! PORT.MatchString(port) {
if !PORT.MatchString(port) {
log.Printf("PORT must be a number between 0 and 65535")
os.Exit(1)
}

username := os.Getenv("ESCAPE_ORGANIZATION_ID")
if ! UUID.MatchString(username) {
if !UUID.MatchString(username) {
log.Printf("ESCAPE_ORGANIZATION_ID must be a UUID in lowercase")
log.Printf("To get your organization id, go to https://app.escape.tech/organization/settings/")
os.Exit(1)
}
password := os.Getenv("ESCAPE_API_KEY")
if ! UUID.MatchString(password) {
if !UUID.MatchString(password) {
log.Printf("ESCAPE_API_KEY must be a UUID in lowercase")
log.Printf("To get your API key, go to https://app.escape.tech/user/profile/")
os.Exit(1)
}

start("0.0.0.0", port, hash(username + password))
start("0.0.0.0", port, hash(username+password))
}

func hash(data string) []byte {
Expand All @@ -62,7 +62,7 @@ func start(addr string, port string, expected_hash []byte) {
proxy := goproxy.NewProxyHttpServer()

auth.ProxyBasic(proxy, "realm", func(user, pass string) bool {
return compare(expected_hash, user + pass)
return compare(expected_hash, user+pass)
})

total := fmt.Sprintf("%s:%s", addr, port)
Expand Down

0 comments on commit b6a71e1

Please sign in to comment.