mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 23:47:33 +08:00
use base context to handle the cases where the user IP address is unavailable
This commit is contained in:
@@ -9,6 +9,11 @@ type NullContext struct {
|
||||
context.Context
|
||||
}
|
||||
|
||||
// ClientIP returns the client IP address, for null context, it always returns the loopback address
|
||||
func (c *NullContext) ClientIP() string {
|
||||
return "127.0.0.1"
|
||||
}
|
||||
|
||||
// GetContextId returns the current context id
|
||||
func (c *NullContext) GetContextId() string {
|
||||
return nullContextId
|
||||
|
||||
Reference in New Issue
Block a user