Bind identd to config address, set read/write deadlines in ident.Server, only reply to ident queries where the remote hosts match

This commit is contained in:
Ken-Håvard Lieng 2020-06-17 03:19:20 +02:00
parent 15ee5ce1c9
commit 04e6e8c7a2
4 changed files with 92 additions and 28 deletions

View file

@ -195,17 +195,24 @@ func (c *Client) Host() string {
return c.Config.Host
}
func (c *Client) LocalPort() string {
func (c *Client) LocalAddr() net.Addr {
c.lock.Lock()
defer c.lock.Unlock()
if c.conn != nil {
_, local, err := net.SplitHostPort(c.conn.LocalAddr().String())
if err == nil {
return local
}
return c.conn.LocalAddr()
}
return ""
return nil
}
func (c *Client) RemoteAddr() net.Addr {
c.lock.Lock()
defer c.lock.Unlock()
if c.conn != nil {
return c.conn.RemoteAddr()
}
return nil
}
func (c *Client) MOTD() []string {