Skip to main content

TCP Variables

Connection Variables

The following connection variables are available on the conn struct:

NameTypeDescription
conn.ClientIPstringThe source IP of the TCP connection to the ngrok endpoint.
conn.Geo.CountryCodestringThe two-letter ISO country code based on the client IP.
conn.Geo.LatitudestringThe approximate latitude based on the client IP.
conn.Geo.LatLongRadiusKmstringThe radius in kilometers around the latitude and longitude where the client IP is likely to originate.
conn.Geo.LongitudestringThe approximate longitude based on the client IP.

conn.ClientIP

The source IP of the TCP connection to the ngrok endpoint as a string.

expressions:
- conn.ClientIP in ['::1', '127.0.0.1']

conn.Geo.CountryCode

The two-letter ISO country code based on the client IP.

expressions:
- conn.Geo.CountryCode != 'US'

conn.Geo.Latitude

The approximate latitude based on the client IP.

expressions:
- double(conn.Geo.Latitude) >= 45.0

conn.Geo.LatLongRadiusKm

The radius in kilometers around the latitude and longitude where the client IP is likely to originate.

expressions:
- conn.Geo.LatLongRadiusKm <= '20'

conn.Geo.Longitude

The approximate longitude based on the client IP.

expressions:
- double(conn.Geo.Longitude) <= -93.0