summaryrefslogtreecommitdiff
path: root/jakob/dynamic/util.scm
diff options
context:
space:
mode:
authorJakob L. Kreuze <zerodaysfordays@sdf.org>2024-08-11 06:58:44 -0400
committerJakob L. Kreuze <zerodaysfordays@sdf.org>2024-08-11 06:58:44 -0400
commit391ec733bf265e3dd0a142123e021f8ab384d9b2 (patch)
tree781ca83f717867df1bffa07d9d4e06584b0b546e /jakob/dynamic/util.scm
parent2a6edfb9341e510dfdc304772906e696064e08a2 (diff)
[dynamic] Guard some functions behind %debug-enabled
Diffstat (limited to 'jakob/dynamic/util.scm')
-rw-r--r--jakob/dynamic/util.scm19
1 files changed, 12 insertions, 7 deletions
diff --git a/jakob/dynamic/util.scm b/jakob/dynamic/util.scm
index e34ae91..f18c497 100644
--- a/jakob/dynamic/util.scm
+++ b/jakob/dynamic/util.scm
@@ -16,6 +16,7 @@
(define-module (jakob dynamic util)
#:use-module (ice-9 match)
+ #:use-module (jakob dynamic config)
#:use-module (rnrs bytevectors)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-19)
@@ -117,16 +118,20 @@ to express my God-given constitutional rights!"
(define (from-tor? request)
"Return whether or not REQUEST was sent by the Tor daemon"
- (let ((originating-ip (assoc-ref (request-headers request) 'x-forwarded-for)))
- (or (string=? "127.0.0.1" originating-ip)
- (string=? "::1" originating-ip))))
+ (if (%debug-enabled)
+ #f
+ (let ((originating-ip (assoc-ref (request-headers request) 'x-forwarded-for)))
+ (or (string=? "127.0.0.1" originating-ip)
+ (string=? "::1" originating-ip)))))
(define (from-i2p? request)
"Return whether or not REQUEST was sent by i2pd"
- (let ((originating-ip (assoc-ref (request-headers request) 'x-forwarded-for)))
- (and (or (string-prefix? "127." originating-ip)
- (string-suffix? ":1" originating-ip))
- (not (from-tor? request)))))
+ (if (%debug-enabled)
+ #f
+ (let ((originating-ip (assoc-ref (request-headers request) 'x-forwarded-for)))
+ (and (or (string-prefix? "127." originating-ip)
+ (string-suffix? ":1" originating-ip))
+ (not (from-tor? request))))))
(define (from-darknet? request)
"Return whether or not REQUEST was sent by a darknet tunnel"