Skip to main content

TLS Variables

Connection Variables

The following connection variables are available on the conn struct:

NameTypeDescription
conn.ClientIPstringThe source IP of the TLS 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.TLS.CertCNstringThe subject common name of the leaf TLS certificate presented by the client for mutual TLS authentication
conn.TLS.CipherSuitestringThe cipher suite negotiated on the connection.
conn.TLS.SNIstringThe Server Name Indication extension sent.
conn.TLS.VersionstringThe TLS Version used on the connection.

conn.ClientIP

The source IP of the TLS 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

conn.TLS.CertCN

The subject common name of the leaf TLS certificate presented by the client for mutual TLS authentication.

expressions:
- conn.TLS.CertCN.startsWith('example')

conn.TLS.CipherSuite

The cipher suite negotiated on the connection.

expressions:
- conn.TLS.CipherSuite.contains('SHA256')

conn.TLS.SNI

The Server Name Indication extension sent.

expressions:
- conn.TLS.SNI.startsWith('domain')

conn.TLS.Version

The TLS Version used on the connection.

expressions:
- conn.TLS.Version.contains('1.3')