コード例 #1
0
ファイル: factories.go プロジェクト: hlm/vamp-router
func compileSocketName(dir string, base string) string {
	postfix := ".sock"
	if len(base) == 0 {
		return (path.Join(dir, (tools.GetMD5Hash(tools.GetUUID()) + postfix)))
	}
	return (path.Join(dir, (tools.GetMD5Hash(base) + postfix)))
}
コード例 #2
0
ファイル: filters.go プロジェクト: hlm/vamp-router
/*
a convenience function for:
1. Generating and/or checking the validity of filter names.
2. Setting the correct, full backend names in filters.
4. Parsing the filter condition to HAproxy ACL conditions
*/
func resolveFilters(route Route) ([]*Filter, *Error) {

	var resolvedFilters []*Filter

	for _, filter := range route.Filters {

		// if the filter name is not given, just generate one
		if len(filter.Name) == 0 {
			filter.Name = tools.GetUUID()
		}

		filter, err := parseFilter(route.Name, filter)

		if err != nil {
			return resolvedFilters, err
		}
		resolvedFilters = append(resolvedFilters, filter)
	}
	return resolvedFilters, nil
}