github.com/imannamdari/v2ray-core/v5@v5.0.5/infra/conf/mergers/extensions.go (about)

     1  package mergers
     2  
     3  import "strings"
     4  
     5  // GetExtensions get extensions of given format
     6  func GetExtensions(formatName string) ([]string, error) {
     7  	lowerName := strings.ToLower(formatName)
     8  	if lowerName == "auto" {
     9  		return GetAllExtensions(), nil
    10  	}
    11  	f, found := mergersByName[lowerName]
    12  	if !found {
    13  		return nil, newError(formatName+" not found", formatName).AtWarning()
    14  	}
    15  	return f.Extensions, nil
    16  }
    17  
    18  // GetAllExtensions get all extensions supported
    19  func GetAllExtensions() []string {
    20  	extensions := make([]string, 0)
    21  	for _, f := range mergersByName {
    22  		extensions = append(extensions, f.Extensions...)
    23  	}
    24  	return extensions
    25  }