Skip to content

Commit

Permalink
feat(vex): add vex client
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuri committed Jul 30, 2018
1 parent 8a84816 commit 33fd402
Show file tree
Hide file tree
Showing 64 changed files with 18,981 additions and 3 deletions.
26 changes: 26 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 21 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,35 @@ import (
"flag"
"fmt"
"net/http"
"os"
"os/signal"
"syscall"

"github.com/bleenco/sharebox/filemanager"
"github.com/bleenco/sharebox/vex"
"github.com/julienschmidt/httprouter"
"github.com/phyber/negroni-gzip/gzip"
"github.com/rs/cors"
"github.com/urfave/negroni"
)

var (
listenAddr = flag.String("port", "0.0.0.0:4505", "server listen address")
rootDir = flag.String("dir", "./", "root serve directory")
listenAddr = flag.String("addr", "0.0.0.0:4505", "server listen address")
rootDir = flag.String("dir", "./", "root serve directory")
enableVex = flag.Bool("vex", false, "enable vex tunnel connection")
remoteServer = flag.String("s", "bleenco.space", "vex server hostname")
remotePort = flag.Int("p", 2200, "vex server SSH port")
localServer = flag.String("ls", "localhost", "local server hostname")
localPort = flag.Int("lp", 4505, "local server port")
)

func main() {
flag.Parse()
filemanager.Init(*rootDir)

ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP)

router := httprouter.New()
c := cors.New(cors.Options{
AllowedOrigins: []string{"http://localhost:4200"},
Expand Down Expand Up @@ -49,5 +61,11 @@ func main() {
n.UseHandler(router)

fmt.Printf("Serving files from %s at %s ...\n", *rootDir, *listenAddr)
http.ListenAndServe(*listenAddr, n)
go http.ListenAndServe(*listenAddr, n)

if *enableVex {
go vexclient.InitClient(*localServer, *remoteServer, *localPort, *remotePort)
}

<-ch
}
24 changes: 24 additions & 0 deletions vendor/github.com/pkg/errors/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions vendor/github.com/pkg/errors/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions vendor/github.com/pkg/errors/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions vendor/github.com/pkg/errors/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions vendor/github.com/pkg/errors/appveyor.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 33fd402

Please sign in to comment.