Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Commit

Permalink
add goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed Jan 16, 2017
1 parent 6769307 commit 18674ba
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: go
go:
- 1.7.x
after_success:
test -n "$TRAVIS_TAG" && curl -s https://raw.githubusercontent.com/goreleaser/get/master/latest | bash
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# wdaproxy
[![Powered By: GoReleaser](https://img.shields.io/badge/powered%20by-goreleaser-green.svg?style=flat-square)](https://github.com/goreleaser)
WebDriverAgent Proxy

Only can work in Mac
Expand Down
12 changes: 12 additions & 0 deletions goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Build customization
build:
main: ./main.go
ldflags: -s -w
gogs:
- darwin
- linux
goarch:
- amd64
files:
- README.md
- LICENSE
20 changes: 18 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
package main

import (
"flag"
"log"
"net/http"
"net/http/httputil"
"net/url"
"os/exec"
"strconv"
)

var (
version = "develop"
lisPort = 8100
)

func main() {
showVer := flag.Bool("v", false, "Print version")
flag.IntVar(&lisPort, "p", 8100, "Proxy listen port")
flag.Parse()

if *showVer {
println(version)
return
}

log.Println("program start......")
errC := make(chan error)

Expand All @@ -17,11 +33,11 @@ func main() {
targetURL, _ := url.Parse("http://127.0.0.1:8200")
httpProxy := httputil.NewSingleHostReverseProxy(targetURL)
http.Handle("/", httpProxy)
errC <- http.ListenAndServe(":8100", nil)
errC <- http.ListenAndServe(":"+strconv.Itoa(lisPort), nil)
}()
go func() {
log.Println("launch iproxy")
c := exec.Command("iproxy", "8200", "8100")
c := exec.Command("iproxy", "8200", strconv.Itoa(lisPort))
errC <- c.Run()
}()

Expand Down

0 comments on commit 18674ba

Please sign in to comment.