Skip to content

Commit 223273d

Browse files
committed
add go mod
1 parent 95edd01 commit 223273d

File tree

9 files changed

+72
-11
lines changed

9 files changed

+72
-11
lines changed

README.md

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
webtravel
2-
=========
1+
2+
# 简介
33

44
VPN(虚拟专用网络)利用加密通信,在公共网络上建立专用网络的技术,外部网络通过加密认证,访问内网数据。SSL VPN 是解决远程用户访问敏感公司数据最简单最安全的解决技术。利用浏览器内置 SSL 协议,无需安装客户端,便可从外网访问内网应用。
55

@@ -11,5 +11,48 @@ webtravel 实现通过 SSL 协议访问后端服务的代理技术。其原理
1111

1212
其中除了html中的链接,还包括js,css中的链接,以及客户端js拼接的地址。当然,其中还需要修改http头中的cookie、referer等信息。webtravel 实现了重要逻辑的修改,可访问twitter,webqq等复杂应用。
1313

14-
体验地址:<https://diy-htmlshow6.rhcloud.com/>。输入要访问的URL即可,比如<http://twitter.com>
14+
# 编译运行
15+
16+
下载代码和编译
17+
18+
```
19+
git clone git@github.com:drawing/webtravel.git
20+
21+
cd webtravel
22+
go build
23+
```
24+
25+
配置修改 `config/site.json`
26+
27+
```
28+
{
29+
"Protocol" : "http",
30+
"Domain" : "webtravel.fancymore.com",
31+
"AccessPath" : "/access/",
32+
"AccessAddress" : "webtravel.fancymore.com:8080",
33+
34+
"ListenAddress" : "0.0.0.0:8080"
35+
}
36+
```
37+
38+
* `Domain` 当前程序的域名
39+
* `AccessAddress` 当前运行的域名:端口,如监听80端口,可不写端口
40+
* `ListenAddress` 当前运行程序监听的 IP 和端口
41+
42+
43+
执行程序
44+
```
45+
./webtravel -config ./config/site.json
46+
```
47+
48+
# 使用
49+
50+
打开首页
51+
52+
![首页](./doc/homepage.png)
53+
54+
输入期望访问的地址,如 `www.baidu.com`,点 `Go`,跳转到目标页面
55+
56+
![baidu](./doc/baidupage.png)
1557

58+
此页面虽然为百度首页,但完全通过 `webtravel` 程序中转,并未直接访问百度资源。

config/site.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"Protocol" : "http",
3-
"Domain" : "ogrebreak.com",
3+
"Domain" : "webtravel.fancymore.com",
44
"AccessPath" : "/access/",
5-
"AccessAddress" : "ogrebreak.com:9100",
5+
"AccessAddress" : "webtravel.fancymore.com:8080",
66

7-
"ListenAddress" : "127.0.0.1:9100"
7+
"ListenAddress" : "0.0.0.0:8080"
88
}

doc/baidupage.png

582 KB
Loading

doc/homepage.png

969 KB
Loading

go.mod

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module webtravel
2+
3+
go 1.20
4+
5+
require github.com/drawing/webtravel v1.0.0
6+
7+
require golang.org/x/net v0.8.0 // indirect
8+
9+
replace github.com/drawing/webtravel v1.0.0 => ./

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
2+
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=

main.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import (
99
"net/http"
1010
"strings"
1111
"text/template"
12+
"flag"
1213

13-
"./transform"
14+
"github.com/drawing/webtravel/transform"
1415
)
1516

1617
import _ "net/http/pprof"
@@ -111,7 +112,13 @@ func TravelHandler(w http.ResponseWriter, r *http.Request) {
111112
}
112113

113114
func main() {
114-
buffer, err := ioutil.ReadFile("./config/site.json")
115+
ConfigFile := flag.String("config", "./config/site.json", "Config File Path")
116+
117+
flag.Parse()
118+
119+
log.Println("read config file:", *ConfigFile)
120+
121+
buffer, err := ioutil.ReadFile(*ConfigFile)
115122
if err != nil {
116123
panic(err)
117124
}

template/home.html

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

transform/html.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"golang.org/x/net/html"
1111
)
1212
import (
13-
"../ecmascript"
13+
"github.com/drawing/webtravel/ecmascript"
1414
)
1515

1616
var c_link_attrs = map[string]bool{

0 commit comments

Comments
 (0)