/repository/microbang.td

http://snova.googlecode.com/ · Unknown · 41 lines · 35 code · 6 blank · 0 comment · 0 complexity · 95bcb14cbb1cb376ddd61cdd3f3bb4aa MD5 · raw file

  1. ##Reserved proxy implementation
  2. $GAE="GAE";
  3. $DIRECT="DIRECT";
  4. $GOOGLE="Google";
  5. $HOSTS="Hosts";
  6. def OnInit()
  7. {
  8. ##Do your business
  9. }
  10. def OnRoutine()
  11. {
  12. #Do your routine business here
  13. #eg: $output=System("./mysh.sh");
  14. # Log($output);
  15. #Tell the script engine to invoke this method 10s later
  16. return 10;
  17. }
  18. def SelectProxy(protocol, method, url, headers)
  19. {
  20. $host = GetHeader($headers, "Host");
  21. if $protocol == "https" && InHosts($host)
  22. {
  23. return $HOSTS;
  24. }
  25. if $host~=".google" || $host~="ytimg."|| $host~="gstatic."|| $host~="developer.android.com" || $host~=".appspot.com"
  26. || $host~="www.youtube.com" || $host~="golang.org"
  27. {
  28. return $GOOGLE;
  29. }
  30. if InHosts($host)
  31. {
  32. return $HOSTS;
  33. }
  34. return $GOOGLE;
  35. }