This repository has been archived by the owner on Aug 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
172 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ caddy.log | |
dist | ||
websocks.cer | ||
websocks.key | ||
*.config.json | ||
*.pac | ||
*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,13 @@ package main | |
import ( | ||
"os" | ||
|
||
"encoding/json" | ||
"errors" | ||
"io/ioutil" | ||
"os/exec" | ||
"runtime" | ||
|
||
"log" | ||
|
||
"github.com/juju/loggo" | ||
"github.com/lzjluzijie/websocks/client" | ||
"github.com/lzjluzijie/websocks/core" | ||
|
@@ -28,8 +29,17 @@ func main() { | |
Author: "Halulu", | ||
Email: "[email protected]", | ||
Action: func(c *cli.Context) (err error) { | ||
app := client.WebSocksClientApp{} | ||
app.RunWeb() | ||
app, err := client.LoadApp() | ||
if err != nil { | ||
log.Println("can not load client.json, create not one") | ||
app = client.NewApp() | ||
err = app.Save() | ||
if err != nil { | ||
log.Printf("save config: %s", err.Error()) | ||
} | ||
} | ||
|
||
err = app.Run() | ||
return | ||
}, | ||
Commands: []cli.Command{ | ||
|
@@ -220,15 +230,14 @@ func main() { | |
Aliases: []string{"w"}, | ||
Usage: "web ui server", | ||
Action: func(c *cli.Context) (err error) { | ||
app := &server.App{} | ||
data, err := ioutil.ReadFile("server.json") | ||
if err != nil { | ||
return | ||
} | ||
|
||
err = json.Unmarshal(data, app) | ||
app, err := server.LoadApp() | ||
if err != nil { | ||
return | ||
log.Println("can not load server.json, create not one") | ||
app = server.NewApp() | ||
err = app.Save() | ||
if err != nil { | ||
log.Printf("save config: %s", err.Error()) | ||
} | ||
} | ||
|
||
err = app.Run() | ||
|