#!/bin/bash

case "${1:-hk}" in
  hk)
    export https_proxy=http://127.0.0.1:3447
    export http_proxy=http://127.0.0.1:3447
    export all_proxy=socks5://127.0.0.1:3447
    export no_proxy="localhost,127.0.0.1,::1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12"
    echo "Proxy: HK (127.0.0.1:3447)"
    ;;
  us)
    export https_proxy=http://127.0.0.1:3448
    export http_proxy=http://127.0.0.1:3448
    export all_proxy=socks5://127.0.0.1:3448
    export no_proxy="localhost,127.0.0.1,::1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12"
    echo "Proxy: US (127.0.0.1:3448)"
    ;;
  stop)
    unset https_proxy http_proxy all_proxy no_proxy
    echo "Proxy: stopped"
    ;;
  *)
    echo "Usage: source out [hk|us|stop]"
    return 1
    ;;
esac
