mirror of
https://github.com/Quiq/docker-registry-ui.git
synced 2025-07-19 08:36:33 +00:00
Store IPv6 addresses correctly
This commit is contained in:
parent
6dc1408576
commit
920e4132f0
@ -4,6 +4,7 @@ import (
|
|||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
@ -26,7 +27,7 @@ const (
|
|||||||
action CHAR(5) NULL,
|
action CHAR(5) NULL,
|
||||||
repository VARCHAR(100) NULL,
|
repository VARCHAR(100) NULL,
|
||||||
tag VARCHAR(100) NULL,
|
tag VARCHAR(100) NULL,
|
||||||
ip VARCHAR(15) NULL,
|
ip VARCHAR(45) NULL,
|
||||||
user VARCHAR(50) NULL,
|
user VARCHAR(50) NULL,
|
||||||
created DATETIME NULL
|
created DATETIME NULL
|
||||||
);
|
);
|
||||||
@ -112,7 +113,10 @@ func (e *EventListener) ProcessEvents(request *http.Request) {
|
|||||||
if tag == "" {
|
if tag == "" {
|
||||||
tag = i.Get("target.digest").String()
|
tag = i.Get("target.digest").String()
|
||||||
}
|
}
|
||||||
ip := strings.Split(i.Get("request.addr").String(), ":")[0]
|
ip := i.Get("request.addr").String()
|
||||||
|
if x, _, _ := net.SplitHostPort(ip); x != "" {
|
||||||
|
ip = x
|
||||||
|
}
|
||||||
user := i.Get("actor.name").String()
|
user := i.Get("actor.name").String()
|
||||||
e.logger.Debugf("Parsed event data: %s %s:%s %s %s ", action, repository, tag, ip, user)
|
e.logger.Debugf("Parsed event data: %s %s:%s %s %s ", action, repository, tag, ip, user)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user