Example #1
0
func getHost() string {
	url := conf.CONFIG.ServerBaseUrl
	if url == "" {
		return "localhost"
	} else {
		_, host := proxy.ParseBaseUrl(url)
		return host
	}
}
Example #2
0
func UrlNeedProxy(url string) bool {
	if conf.CONFIG.FilterMode == "" {
		// no filter config
		return true
	}
	_, host := proxy.ParseBaseUrl(url)
	for _, p := range patterns {
		if p.MatchString(host) {
			return filterMode == FILTER_MODE_WHITE_LIST
		}
	}
	return filterMode == FILTER_MODE_BLACK_LIST
}