only allow admin access via unix socket
This commit is contained in:
parent
39cae64854
commit
13780f1c74
5 changed files with 73 additions and 16 deletions
|
|
@ -40,6 +40,8 @@ type Context struct {
|
|||
|
||||
Data *ContextData
|
||||
Log logr.Logger
|
||||
|
||||
ip string
|
||||
}
|
||||
|
||||
// Method returns the request method
|
||||
|
|
@ -69,7 +71,15 @@ func (c *Context) Form(name string) string {
|
|||
}
|
||||
|
||||
func (c *Context) ClientIP() (host string) {
|
||||
host, _, _ = net.SplitHostPort(c.Request.RemoteAddr)
|
||||
host = c.Request.RemoteAddr
|
||||
if host == "@" {
|
||||
return
|
||||
}
|
||||
if c.ip != "" {
|
||||
return c.ip
|
||||
}
|
||||
host, _, _ = net.SplitHostPort(host)
|
||||
c.ip = host
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue