Networking
When I was creating a one script, which uses JWT for authentication, I began to run into challenges with longer scripts that extended beyond the expiration of a single JWT.
To elegantly solve this, I used decorators to check the token’s expiration and request a new token if necessary. This article goes over the framework I set up so that you can apply a similar mechanism in your own scripts.
Setting the Scene
To get started, I’ve outlined all the parts needed to set up our token-refreshing framework.
In the previous articles, we showed how to perform packet marking in nftables based on geoip source ip addresses
and also how to log traffic to external files
.
Today we will show how to mark packets based on which continent they come from.
The principle is that we first mark packets based on the source IP address so that we know which countries they are coming from. And then we'll find out which continent the state is on.