Skip to content

Commit

Permalink
Fix log RemoteAddr
Browse files Browse the repository at this point in the history
  • Loading branch information
ac0d3r committed Dec 15, 2021
1 parent 172585d commit 1507d3f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions hyuga/handler/oob/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ func (d *DnsServer) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {
isDnsRebinding bool
)
if identity != "" && database.UserExist(identity) {
rhost, _, _ := net.SplitHostPort(w.RemoteAddr().String())
record := database.DnsRecord{
Name: name,
RemoteAddr: rhost,
RemoteAddr: GetRequestHost(w.RemoteAddr().String()),
Created: time.Now().Unix(),
}
if err := database.SetUserRecord(identity, record, config.C.RecordExpiration); err != nil {
Expand Down
3 changes: 1 addition & 2 deletions hyuga/handler/oob/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ func HttpLog(c *gin.Context) {

if identity != "" && database.UserExist(identity) {
req, _ := httputil.DumpRequest(c.Request, true)
rip, _, _ := net.SplitHostPort(getRealIP(c.Request))
record := database.HttpRecord{
URL: c.Request.URL.String(),
Method: c.Request.Method,
RemoteAddr: rip,
RemoteAddr: getRealIP(c.Request),
Created: time.Now().Unix(),
Raw: string(req),
}
Expand Down

0 comments on commit 1507d3f

Please sign in to comment.