#!/usr/bin/env python3

# A simple utility for filter ips. Only use this if you don't use a server with blocking ips system

from settings import config
from bottle import request

def filterip():
    """Function for flter ip
    
    """
    
    ip=request.environ.get('X-REAL-IP') or request.environ.get('HTTP_X_FORWARDED_FOR') or request.environ.get('REMOTE_ADDR')
    
    if ip in config.allowed_ips:
    
        return True
    else:
        
        return False
    
