-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add pac support and ready to add config file
- Loading branch information
Showing
9 changed files
with
5,657 additions
and
5 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,29 @@ | ||
package fly | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
"net/http" | ||
"os" | ||
) | ||
|
||
func StartPAC() { | ||
http.HandleFunc("/flynet.pac", func (w http.ResponseWriter, r *http.Request){ | ||
// the pac file should be placed at the same dir with current running file. | ||
// but it is placed at the parent dir when development | ||
file, err := os.Open(`flynet.pac`) | ||
if err != nil { | ||
fmt.Println(err) | ||
// run from cmd/client/ | ||
file, _ = os.Open("../../flynet.pac") | ||
} | ||
w.Header().Set("Content-Type", "application/x-ns-proxy-autoconfig") | ||
io.Copy(w, file) | ||
w.WriteHeader(200) | ||
|
||
}) | ||
err := http.ListenAndServe(":8080", nil) | ||
if err != nil { | ||
fmt.Println("start failed --->", err) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package fly | ||
|
||
import "testing" | ||
|
||
func TestStartPAC(t *testing.T) { | ||
StartPAC() | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# flynet config file | ||
# | ||
# multiple line you can use `` | ||
# | ||
|
||
[server] | ||
mode = socks-tcp | ||
port = 8888 # listen port for client to connect | ||
method = "aes-256-cfb" | ||
password = | ||
# verbose = true | ||
# log = flynet.log | ||
|
||
|
||
[client] | ||
mode = socks-tcp | ||
port = 1080 # local socks5 listen port | ||
serverAddr = example.com:8080 # include host and port | ||
method = "aes-256-cfb" | ||
password = | ||
# verbose = true | ||
# log = flynet.log |
Oops, something went wrong.