diff --git a/pkg/proxy/http.go b/pkg/proxy/http.go
index 33ce9f2..d4d1aba 100755
--- a/pkg/proxy/http.go
+++ b/pkg/proxy/http.go
@@ -23,12 +23,12 @@ import (
type HttpRecord struct {
Count int
- LastAt time.Time
+ LastAt string
}
func (r *HttpRecord) Update() {
r.Count += 1
- r.LastAt = time.Now()
+ r.LastAt = time.Now().Local().String()
}
type HttpProxy struct {
@@ -389,57 +389,71 @@ func (t *HttpProxy) Start() {
var httpTmpl = map[string]string{
"stats": `
-
-
- | Configuration: |
- json |
-
-
- | StartAt: |
- {{ .StartAt }} |
-
-
- | Total: |
- {{ .Total }} |
-
-
-
-
-
- | Domain |
- Count |
- LastAt |
-
- {{- range $k, $v := .Requests }}
-
- | {{ $k }} |
- {{ $v.Count }} |
- {{ $v.LastAt }} |
-
- {{- end }}
-
`,
-
+
+
+
+
+ OpenLAN Proxy
+
+
+
+
+
+ | Configuration: | display |
+
+
+ | StartAt: | {{ .StartAt }} |
+
+
+ | Total: | {{ .Total }} |
+
+
+
+
+ | Domain | Count | LastAt |
+
+ {{- range $k, $v := .Requests }}
+
+ | {{ $k }} | {{ $v.Count }} | {{ $v.LastAt }} |
+
+ {{- end }}
+
+
+`,
"pac": `
function FindProxyForURL(url, host) {
- if (isPlainHostName(host))
- return "DIRECT";
+ if (isPlainHostName(host))
+ return "DIRECT";
{{- range .Rules }}
- if (shExpMatch(host, "(^|*\.){{ . }}"))
- return "PROXY {{ $.Local }}";
+ if (shExpMatch(host, "(^|*\.){{ . }}"))
+ return "PROXY {{ $.Local }}";
{{- end }}
- return "DIRECT";
+ return "DIRECT";
}`,
}
func (t *HttpProxy) GetStats(w http.ResponseWriter, r *http.Request) {
data := &struct {
- StartAt time.Time
+ StartAt string
Total int
Requests map[string]*HttpRecord
}{
Total: len(t.requests),
Requests: t.requests,
- StartAt: t.startat,
+ StartAt: t.startat.Local().String(),
}
if tmpl, err := template.New("main").Parse(httpTmpl["stats"]); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
diff --git a/pkg/switch/ipsec.go b/pkg/switch/ipsec.go
index a2f4ffa..19d0d3f 100644
--- a/pkg/switch/ipsec.go
+++ b/pkg/switch/ipsec.go
@@ -69,8 +69,7 @@ conn {{ .Name }}-c2
rightid=@c1.{{ .RightId }}.{{ .Transport }}
{{- end }}
leftprotoport=udp
- rightprotoport=udp/8472
-`,
+ rightprotoport=udp/8472`,
"gre": `
conn {{ .Name }}-c1
auto=add
@@ -92,11 +91,9 @@ conn {{ .Name }}-c1
{{- end }}
authby=secret
leftprotoport=gre
- rightprotoport=gre
-`,
+ rightprotoport=gre`,
"secret": `
-%any @{{ .RightId }}.{{ .Transport }} : PSK "{{ .Secret }}"
-`,
+%any @{{ .RightId }}.{{ .Transport }} : PSK "{{ .Secret }}"`,
}
func (w *IPSecWorker) Initialize() {