mirror of
https://github.com/aljazceru/khatru.git
synced 2025-12-18 22:14:22 +01:00
add khatru.IsInternal() for dealing with internal calls specifically in QueryEvents()
This commit is contained in:
7
utils.go
7
utils.go
@@ -10,6 +10,7 @@ const (
|
||||
wsKey = iota
|
||||
subscriptionIdKey
|
||||
nip86HeaderAuthKey
|
||||
internalCallKey
|
||||
)
|
||||
|
||||
func RequestAuth(ctx context.Context) {
|
||||
@@ -40,6 +41,12 @@ func GetAuthed(ctx context.Context) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// IsInternalCall returns true when a call to QueryEvents, for example, is being made because of a deletion
|
||||
// or expiration request.
|
||||
func IsInternalCall(ctx context.Context) bool {
|
||||
return ctx.Value(internalCallKey) != nil
|
||||
}
|
||||
|
||||
func GetIP(ctx context.Context) string {
|
||||
conn := GetConnection(ctx)
|
||||
if conn == nil {
|
||||
|
||||
Reference in New Issue
Block a user