http: better logging

This commit is contained in:
nadoo committed 2020-09-13 23:28:01 +08:00
1 parent 0e89d1879f
commit b3b11b4188
4 files changed
+8 -10

No files matched your search

+4
View File
@@ -13,6 +13,8 @@ jobs:
uses: actions/setup-go@v1
with:
go-version: 1.15.x
- name: Go Env
run: go env
- name: Test
run: go test -v .
@@ -27,5 +29,7 @@ jobs:
uses: actions/setup-go@v1
with:
go-version: 1.15.x
- name: Go Env
run: go env
- name: Build
run: go build -v .
+2
View File
@@ -17,6 +17,8 @@ jobs:
uses: actions/setup-go@v1
with:
go-version: 1.15.x
- name: Go Env
run: go env
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
+1 -9
View File
@@ -1,10 +1,8 @@
package main
import (
"context"
"fmt"
stdlog "log"
"net"
"os"
"os/signal"
"syscall"
@@ -36,7 +34,7 @@ import (
_ "github.com/nadoo/glider/proxy/ws"
)
var version = "0.10.3"
var version = "0.10.4"
func main() {
// read configs
@@ -78,12 +76,6 @@ func main() {
}
d.Start()
net.DefaultResolver.PreferGo = true
net.DefaultResolver.Dial = func(ctx context.Context, network, address string) (net.Conn, error) {
d := net.Dialer{}
return d.DialContext(ctx, "udp", conf.DNS)
}
}
// enable checkers
+1 -1
View File
@@ -161,7 +161,7 @@ func (s *HTTP) servHTTP(req *request, c *conn.Conn) {
writeStartLine(buf, proto, code, status)
writeHeaders(buf, header)
log.F("[http] %s <-> %s", c.RemoteAddr(), req.target)
log.F("[http] %s <-> %s via %s", c.RemoteAddr(), req.target, dialer.Addr())
c.Write(buf.Bytes())
conn.Copy(c, r)