Compare commits
3 Commits
v1.0.0-rc2
...
v1.0.0-rc4
Author | SHA1 | Date | |
---|---|---|---|
6e9947809c | |||
874b1c541a | |||
28dd17ccee |
@ -26,7 +26,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
version = "1.0.0-rc2"
|
version = "1.0.0-rc4"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -227,7 +227,12 @@ func handleConnection(connClt net.Conn, conLdap *ldap.Conn) {
|
|||||||
// First query netCache built with ipNetworkNumber
|
// First query netCache built with ipNetworkNumber
|
||||||
res, err := isIPContainedInNetCache(ip)
|
res, err := isIPContainedInNetCache(ip)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if strings.EqualFold(err.Error(), fmt.Sprintf("Invalid IP: %s", ip)) {
|
||||||
|
// We don't want those msg to pollute logs
|
||||||
|
logstream.Info(err.Error())
|
||||||
|
} else {
|
||||||
logstream.Error(err.Error())
|
logstream.Error(err.Error())
|
||||||
|
}
|
||||||
sendResponse(connClt, err.Error(), 500)
|
sendResponse(connClt, err.Error(), 500)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -301,7 +306,7 @@ func connectLdap() (*ldap.Conn, error) {
|
|||||||
}
|
}
|
||||||
err = conLdap.Bind(*ldapUser, *ldapPass)
|
err = conLdap.Bind(*ldapUser, *ldapPass)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logstream.Errorf("Error binding LDAP: ", err)
|
logstream.Errorf("Error binding LDAP: %s", err)
|
||||||
return conLdap, err
|
return conLdap, err
|
||||||
}
|
}
|
||||||
return conLdap, err
|
return conLdap, err
|
||||||
@ -349,7 +354,7 @@ func main() {
|
|||||||
ldapBaseDN = fs.String("ldapDN", "", "LDAP base DN (also via LDAPDN env var)")
|
ldapBaseDN = fs.String("ldapDN", "", "LDAP base DN (also via LDAPDN env var)")
|
||||||
ldapUser = fs.String("ldapUser", "", "LDAP user DN (also via LDAPUSER env var)")
|
ldapUser = fs.String("ldapUser", "", "LDAP user DN (also via LDAPUSER env var)")
|
||||||
ldapPass = fs.String("ldapPass", "", "LDAP user password (also via LDAPPASS env var)")
|
ldapPass = fs.String("ldapPass", "", "LDAP user password (also via LDAPPASS env var)")
|
||||||
pidFilePath = fs.String("pidfile", "/var/run/mynettcptable/mynettcptable.pid", "PID File (also via PIDFILE env var)")
|
pidFilePath = fs.String("pidfile", "", "PID File (also via PIDFILE env var). Creates pidfile only if defined")
|
||||||
refreshInterval = fs.Int("refresh", 300, "Net cache update interval in seconds")
|
refreshInterval = fs.Int("refresh", 300, "Net cache update interval in seconds")
|
||||||
timeout = fs.Int("timeout", 5, "timeout in seconds")
|
timeout = fs.Int("timeout", 5, "timeout in seconds")
|
||||||
_ = fs.String("config", "", "config file (optional)")
|
_ = fs.String("config", "", "config file (optional)")
|
||||||
@ -403,11 +408,13 @@ func main() {
|
|||||||
logstream.Hooks.Add(hook)
|
logstream.Hooks.Add(hook)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(*pidFilePath) > 0 {
|
||||||
if pid, err := pidfile.Create(*pidFilePath); err != nil {
|
if pid, err := pidfile.Create(*pidFilePath); err != nil {
|
||||||
logstream.Fatal(err)
|
logstream.Fatal(err)
|
||||||
} else {
|
} else {
|
||||||
defer pid.Clear()
|
defer pid.Clear()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
logstream.Infof("Start listening for incoming connections on %s\n", *listen)
|
logstream.Infof("Start listening for incoming connections on %s\n", *listen)
|
||||||
run()
|
run()
|
||||||
|
Reference in New Issue
Block a user