Each operator has a group of IP addresses. If you know the network address of the operator, you can compare the IP address of the visitor with the address of the operator.
So, for example, if you know that the mobile operator owns a group of ip addresses, starting from 212.235.*.*
you compare the first 16 bits of the visitor’s address with it, if, for example, the visitor’s address is 212.235.190.215, you know that he is coming from the mobile network.
You can check this condition with simple string operations - compare the first x characters of the guest ip address with the x known characters at the beginning of the operator's IP address.
source share