github.com/apptainer/singularity@v3.1.1+incompatible/internal/pkg/client/oci/transports.go (about)

     1  // Copyright (c) 2018, Sylabs Inc. All rights reserved.
     2  // This software is licensed under a 3-clause BSD license. Please consult the
     3  // LICENSE.md file distributed with the sources of this project regarding your
     4  // rights to use or distribute this software.
     5  
     6  package oci
     7  
     8  import (
     9  	"github.com/containers/image/transports"
    10  )
    11  
    12  // IsSupported returns whether or not the transport given is supported. To fit within a switch/case
    13  // statement, this function will return transport if it is supported
    14  func IsSupported(transport string) string {
    15  	for _, t := range transports.ListNames() {
    16  		if transport == t {
    17  			return transport
    18  		}
    19  	}
    20  
    21  	return ""
    22  }