github.com/MontFerret/ferret@v0.18.0/pkg/drivers/cdp/network/resources.go (about)

     1  package network
     2  
     3  import "github.com/mafredri/cdp/protocol/network"
     4  
     5  var (
     6  	resourceTypeMapping = map[string]network.ResourceType{
     7  		"document":           network.ResourceTypeDocument,
     8  		"stylesheet":         network.ResourceTypeStylesheet,
     9  		"css":                network.ResourceTypeStylesheet,
    10  		"image":              network.ResourceTypeImage,
    11  		"media":              network.ResourceTypeMedia,
    12  		"font":               network.ResourceTypeFont,
    13  		"script":             network.ResourceTypeScript,
    14  		"js":                 network.ResourceTypeScript,
    15  		"texttrack":          network.ResourceTypeTextTrack,
    16  		"xhr":                network.ResourceTypeXHR,
    17  		"ajax":               network.ResourceTypeXHR,
    18  		"fetch":              network.ResourceTypeFetch,
    19  		"eventsource":        network.ResourceTypeEventSource,
    20  		"websocket":          network.ResourceTypeWebSocket,
    21  		"manifest":           network.ResourceTypeManifest,
    22  		"sxg":                network.ResourceTypeSignedExchange,
    23  		"ping":               network.ResourceTypePing,
    24  		"cspViolationReport": network.ResourceTypeCSPViolationReport,
    25  		"other":              network.ResourceTypeOther,
    26  	}
    27  )
    28  
    29  func toResourceType(alias string) network.ResourceType {
    30  	rt, found := resourceTypeMapping[alias]
    31  
    32  	if found {
    33  		return rt
    34  	}
    35  
    36  	return network.ResourceTypeNotSet
    37  }