_id stringlengths 2 7 | text stringlengths 6 2.61k | title stringclasses 1
value |
|---|---|---|
c6100 | // Lookup looks up the full hash in the threat list and returns a partial
// hash and a set of ThreatDescriptors that may match the full hash. | |
c6101 | // setError clears the database state and sets the last error to be err.
//
// This assumes that the db.mu lock is already held. | |
c6102 | // isStale checks whether the last successful update should be considered stale.
// Staleness is defined as being older than two of the configured update periods
// plus jitter. | |
c6103 | // setStale sets the error state to a stale message, without clearing
// the database state.
//
// This assumes that the db.ml lock is already held. | |
c6104 | // clearError clears the db error state, and unblocks any callers of
// WaitUntilReady.
//
// This assumes that the db.mu lock is already held. | |
c6105 | // generateThreatsForUpdate regenerates the threatsForUpdate hashes from
// the threatsForLookup. We do this to avoid holding onto the hash lists for
// a long time, needlessly occupying lots of memory.
//
// This assumes that the db.mu lock is already held. | |
c6106 | // generateThreatsForLookups regenerates the threatsForLookup data structure
// from the threatsForUpdate data structure and stores the last timestamp.
// Since the hashes are effectively stored as a set inside the threatsForLookup,
// we clear out the hashes slice in threatsForUpdate so that it can be GCed.
//
// This assumes that the db.mu lock is already held. | |
c6107 | // saveDatabase saves the database threat list to a file. | |
c6108 | // loadDatabase loads the database state from a file. | |
c6109 | // update updates the threat list according to the API response. | |
c6110 | // unmarshal reads pbResp from req. The mime will either be JSON or ProtoBuf. | |
c6111 | // marshal writes pbResp into resp. The mime can either be JSON or ProtoBuf. | |
c6112 | // serveStatus writes a simple JSON with server status information to resp. | |
c6113 | // serveRedirector implements a basic HTTP redirector that will filter out
// redirect URLs that are unsafe according to the Safe Browsing API. | |
c6114 | // generateHashes returns a set of full hashes for all patterns in the URL. | |
c6115 | // generatePatterns returns all possible host-suffix and path-prefix patterns
// for the input URL. | |
c6116 | // isHex reports whether c is a hexadecimal character. | |
c6117 | // isUnicode reports whether s is a Unicode string. | |
c6118 | // escape returns the percent-encoded form of the string s. | |
c6119 | // unescape returns the decoded form of a percent-encoded string s. | |
c6120 | // recursiveUnescape unescapes the string s recursively until it cannot be
// unescaped anymore. It reports an error if the unescaping process seemed to
// have no end. | |
c6121 | // normalizeEscape performs a recursive unescape and then escapes the string
// exactly once. It reports an error if it was unable to unescape the string. | |
c6122 | // parseHost parses a string to get host by the stripping the
// username, password, and port. | |
c6123 | // parseURL parses urlStr as a url.URL and reports an error if not possible. | |
c6124 | // generateLookupHosts returns a list of host-suffixes for the input URL. | |
c6125 | // generateLookupPaths returns a list path-prefixes for the input URL. | |
c6126 | // hashFromPattern returns a full hash for the given URL pattern. | |
c6127 | // HasPrefix reports whether other is a prefix of h. | |
c6128 | // IsValid reports whether the hash is a valid partial or full hash. | |
c6129 | // decodeHashes takes a ThreatEntrySet and returns a list of hashes that should
// be added to the local database. | |
c6130 | // decodeIndices takes a ThreatEntrySet for removals returned by the server and
// returns a list of indices that the client should remove from its database. | |
c6131 | // decodeRiceIntegers decodes a list of Golomb-Rice encoded integers. | |
c6132 | // BitsRemaining reports the number of bits left to read. | |
c6133 | // setDefaults configures Config to have default parameters.
// It reports whether the current configuration is valid. | |
c6134 | // NewSafeBrowser creates a new SafeBrowser.
//
// The conf struct allows the user to configure many aspects of the
// SafeBrowser's operation. | |
c6135 | // Status reports the status of SafeBrowser. It returns some statistics
// regarding the operation, and an error representing the status of its
// internal state. Most errors are transient and will recover themselves
// after some period. | |
c6136 | // WaitUntilReady blocks until the database is not in an error state.
// Returns nil when the database is ready. Returns an error if the provided
// context is canceled or if the SafeBrowser instance is Closed. | |
c6137 | // Close cleans up all resources.
// This method must not be called concurrently with other lookup methods. | |
c6138 | // doRequests performs a POST to requestPath. It uses the marshaled form of req
// as the request body payload, and automatically unmarshals the response body
// payload as resp. | |
c6139 | // ListUpdate issues a FetchThreatListUpdates API call and returns the response. | |
c6140 | // HashLookup issues a FindFullHashes API call and returns the response. | |
c6141 | // MarshalJSON implements the json.Marshaler interface.
// The Duration field is marshaled in seconds, all other fields are marshaled
// based upon the definitions in struct tags. | |
c6142 | // UnmarshalJSON implements the json.Unmarshaler interface.
// The Duration field is expected to be in seconds, all other field types
// match the struct definition. | |
c6143 | // ToJSON encodes f into a JSON string. Returns an error if marshalling fails. | |
c6144 | // JSONFeed creates a new JSONFeed with a generic Feed struct's data. | |
c6145 | // create a new RssItem with a generic Item struct's data | |
c6146 | // create a new RssFeed with a generic Feed struct's data | |
c6147 | // add a new Item to a Feed | |
c6148 | // returns the first non-zero time formatted as a string or "" | |
c6149 | // creates an Atom representation of this feed | |
c6150 | // WriteAtom writes an Atom representation of this feed to the writer. | |
c6151 | // creates an Rss representation of this feed | |
c6152 | // WriteRss writes an RSS representation of this feed to the writer. | |
c6153 | // ToJSON creates a JSON Feed representation of this feed | |
c6154 | // WriteJSON writes an JSON representation of this feed to the writer. | |
c6155 | // Sort sorts the Items in the feed with the given less function. | |
c6156 | // create a new uuid v4 | |
c6157 | // create a new AtomFeed with a generic Feed struct's data | |
c6158 | // add returns p+x.
//
// The whySafe string is ignored, so that the function still inlines
// as efficiently as p+x, but all call sites should use the string to
// record why the addition is safe, which is to say why the addition
// does not cause x to advance to the very end of p's allocation
// and therefore point incorrectly at the next block in memory. | |
c6159 | // discoverTypes initializes types and packages | |
c6160 | // TypeByName return the type by its name, just like Class.forName in java | |
c6161 | // TypeByPackageName return the type by its package and name | |
c6162 | // DynamicLargeObjectCreateFile creates a dynamic large object
// returning an object which satisfies io.Writer, io.Seeker, io.Closer
// and io.ReaderFrom. The flags are as passes to the
// largeObjectCreate method. | |
c6163 | // DynamicLargeObjectCreate creates or truncates an existing dynamic
// large object returning a writeable object. This sets opts.Flags to
// an appropriate value before calling DynamicLargeObjectCreateFile | |
c6164 | // DynamicLargeObjectDelete deletes a dynamic large object and all of its segments. | |
c6165 | // DynamicLargeObjectMove moves a dynamic large object from srcContainer, srcObjectName to dstContainer, dstObjectName | |
c6166 | // createDLOManifest creates a dynamic large object manifest | |
c6167 | // newAuth - create a new Authenticator from the AuthUrl
//
// A hint for AuthVersion can be provided | |
c6168 | // v1 Authentication - make request | |
c6169 | // v1 Authentication - read response | |
c6170 | // v1 Authentication - read storage url | |
c6171 | // v2 Authentication - make request | |
c6172 | // v2 Authentication - read response | |
c6173 | // Finds the Endpoint Url of "type" from the v2AuthResponse using the
// Region if set or defaulting to the first one if not
//
// Returns "" if not found | |
c6174 | // v2 Authentication - read expires | |
c6175 | // Returns a wrapper around the reader which obeys an idle
// timeout. The cancel function is called if the timeout happens | |
c6176 | // Returns a new reader which will kick the watchdog timer whenever data is read | |
c6177 | // StaticLargeObjectCreateFile creates a static large object returning
// an object which satisfies io.Writer, io.Seeker, io.Closer and
// io.ReaderFrom. The flags are as passed to the largeObjectCreate
// method. | |
c6178 | // StaticLargeObjectCreate creates or truncates an existing static
// large object returning a writeable object. This sets opts.Flags to
// an appropriate value before calling StaticLargeObjectCreateFile | |
c6179 | // StaticLargeObjectDelete deletes a static large object and all of its segments. | |
c6180 | // StaticLargeObjectMove moves a static large object from srcContainer, srcObjectName to dstContainer, dstObjectName | |
c6181 | // createSLOManifest creates a static large object manifest | |
c6182 | // manage is similar to the swift storage method, but uses the CDN Management URL for CDN specific calls. | |
c6183 | // ContainerCDNDisable disables CDN access to a container. | |
c6184 | // Cancel the request | |
c6185 | // Reset a timer | |
c6186 | // largeObjectCreate creates a large object at opts.Container, opts.ObjectName.
//
// opts.Flags can have the following bits set
// os.TRUNC - remove the contents of the large object if it exists
// os.APPEND - write at the end of the large object | |
c6187 | // LargeObjectDelete deletes the large object named by container, path | |
c6188 | // Seek sets the offset for the next write operation | |
c6189 | // Write satisfies the io.Writer interface | |
c6190 | // Metadata gets the Metadata starting with the metaPrefix out of the Headers.
//
// The keys in the Metadata will be converted to lower case | |
c6191 | // Turns a number of ns into a floating point string in seconds
//
// Trims trailing zeros and guaranteed to be perfectly accurate | |
c6192 | // Turns a floating point string in seconds into a ns integer
//
// Guaranteed to be perfectly accurate | |
c6193 | // newError make a new error from a string. | |
c6194 | // newErrorf makes a new error from sprintf parameters. | |
c6195 | // drainAndClose discards all data from rd and closes it.
// If an error occurs during Read, it is discarded. | |
c6196 | // parseHeaders checks a response for errors and translates into
// standard errors if necessary. If an error is returned, resp.Body
// has been drained and closed. | |
c6197 | // Does an http request using the running timer passed in | |
c6198 | // Set defaults for any unset values
//
// Call with authLock held | |
c6199 | // Authenticate connects to the Swift server.
//
// If you don't call it before calling one of the connection methods
// then it will be called for you on the first access. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.