Asn
Configures ASN and geolocation data sources for IP address lookups.
This object can be configured from the WebUI under Settings › Network › ASN & GeoIP
Fields
Asn is a multi-variant object: each instance has an @type discriminator selecting one of the variants below, and each variant carries its own set of fields.
@type: "Disabled"
Disabled
@type: "Resource"
URL Resource
expires
Type:
Duration· default:"1d"How often to refresh the ASN/Geo data.
maxSize
Type:
Size· default:"100mb"Maximum size of the ASN/Geo data file.
timeout
Type:
Duration· default:"5m"Time after which the ASN/Geo resource fetch is considered failed.
asnUrls
Type:
String[]URLs to fetch CSV file containing the IP to ASN mappings.
geoUrls
Type:
String[]URLs to fetch CSV file containing the IP to country code mappings.
httpAuth
Type:
HttpAuth· requiredThe type of HTTP authentication to use
httpHeaders
Type:
Map<String, String>Additional headers to include in HTTP requests
@type: "Dns"
DNS Lookup
indexAsn
Type:
UnsignedInt· default:0The position of the ASN in the DNS TXT record.
indexAsnName
Type:
UnsignedInt?The position of the ASN Name in the DNS TXT record.
indexCountry
Type:
UnsignedInt?The position of the country code in the DNS TXT record.
separator
Type:
String· default:"|"The separator character used in the DNS TXT record.
zoneIpV4
Type:
String· requiredThe DNS zone to query for IPv4 ASN and geolocation data.
zoneIpV6
Type:
String· requiredThe DNS zone to query for IPv6 ASN and geolocation data.
JMAP API
The Asn singleton is available via the urn:stalwart:jmap capability.
x:Asn/get
This is a standard Foo/get method as defined in RFC 8620, Section 5.1.
For singletons, the ids argument should be the literal singleton (or null to return the single instance).
This method requires the sysAsnGet permission.
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:Asn/get",
{
"ids": [
"singleton"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'
x:Asn/set
This is a standard Foo/set method as defined in RFC 8620, Section 5.3.
For singletons, only the update argument with id singleton is accepted; create and destroy arguments are rejected.
This method requires the sysAsnUpdate permission.
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:Asn/set",
{
"update": {
"singleton": {
"id": "id1"
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'
CLI
stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.
Fetch
stalwart-cli get asn
Update
stalwart-cli update asn --field description='Updated'
Nested types
HttpAuth
Defines the HTTP authentication method to use for HTTP requests.
Unauthenticated: Anonymous. No additional fields.Basic: Basic Authentication. Carries the fields ofHttpAuthBasic.Bearer: Bearer Token. Carries the fields ofHttpAuthBearer.
HttpAuthBasic
HTTP Basic authentication credentials.
username
Type:
String· requiredUsername for HTTP Basic Authentication
secret
Type:
SecretKey· requiredPassword for HTTP Basic Authentication
SecretKey
A secret value provided directly, from an environment variable, or from a file.
Value: Secret value. Carries the fields ofSecretKeyValue.EnvironmentVariable: Secret read from environment variable. Carries the fields ofSecretKeyEnvironmentVariable.File: Secret read from file. Carries the fields ofSecretKeyFile.
SecretKeyValue
A secret value provided directly.
secret
Type:
String· required · secretPassword or secret value
SecretKeyEnvironmentVariable
A secret value read from an environment variable.
variableName
Type:
String· requiredEnvironment variable name to read the secret from
SecretKeyFile
A secret value read from a file.
filePath
Type:
String· requiredFile path to read the secret from
HttpAuthBearer
HTTP Bearer token authentication.
bearerToken
Type:
SecretKey· requiredBearer token for HTTP Bearer Authentication