CCrypto VPN public website https://vpn.ccrypto.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
766 B

  1. from django.conf import settings
  2. from constance import config
  3. from datetime import timedelta
  4. def get_client_ip(request):
  5. header_name = settings.REAL_IP_HEADER_NAME
  6. if header_name:
  7. header_name = header_name.replace('-', '_').upper()
  8. value = request.META.get('HTTP_' + header_name)
  9. if value:
  10. return value.split(',', 1)[0]
  11. return request.META.get('REMOTE_ADDR')
  12. def get_price():
  13. return config.MONTHLY_PRICE_EUR
  14. def get_price_float():
  15. return get_price() / 100
  16. def get_trial_period_duration():
  17. return config.TRIAL_PERIOD_HOURS * timedelta(hours=1)
  18. def parse_integer_list(ls):
  19. l = ls.split(',')
  20. l = [p.strip() for p in l]
  21. l = [p for p in l if p]
  22. l = [int(p) for p in l]
  23. return l