@@ -1832,6 +1832,190 @@ func (r *HTTPRequest) DownstreamFastlyKeyIsValid() (bool, error) {
18321832 return valid .b , nil
18331833}
18341834
1835+ // witx:
1836+ //
1837+ // (@interface func (export "downstream_bot_analyzed")
1838+ // (param $req $request_handle)
1839+ // (result $err (expected $bot_analyzed (error $fastly_status)))
1840+ // )
1841+ //
1842+ //go:wasmimport fastly_http_downstream downstream_bot_analyzed
1843+ //go:noescape
1844+ func fastlyHTTPDownstreamBotAnalyzed (
1845+ req requestHandle ,
1846+ analyzed prim.Pointer [bool ],
1847+ ) FastlyStatus
1848+
1849+ func (r * HTTPRequest ) DownstreamBotAnalyzed () (bool , error ) {
1850+ var analyzed struct {
1851+ b bool
1852+ _ prim.Usize // align padding
1853+ }
1854+ if err := fastlyHTTPDownstreamBotAnalyzed (
1855+ r .h ,
1856+ prim .ToPointer (& analyzed .b ),
1857+ ).toError (); err != nil {
1858+ return false , err
1859+ }
1860+
1861+ return analyzed .b , nil
1862+ }
1863+
1864+ // witx:
1865+ //
1866+ // (@interface func (export "downstream_bot_detected")
1867+ // (param $req $request_handle)
1868+ // (result $err (expected $bot_detected (error $fastly_status)))
1869+ // )
1870+ //
1871+ //go:wasmimport fastly_http_downstream downstream_bot_detected
1872+ //go:noescape
1873+ func fastlyHTTPDownstreamBotDetected (
1874+ req requestHandle ,
1875+ analyzed prim.Pointer [bool ],
1876+ ) FastlyStatus
1877+
1878+ func (r * HTTPRequest ) DownstreamBotDetected () (bool , error ) {
1879+ var detected struct {
1880+ b bool
1881+ _ prim.Usize // align padding
1882+ }
1883+ if err := fastlyHTTPDownstreamBotDetected (
1884+ r .h ,
1885+ prim .ToPointer (& detected .b ),
1886+ ).toError (); err != nil {
1887+ return false , err
1888+ }
1889+
1890+ return detected .b , nil
1891+ }
1892+
1893+ // witx:
1894+ //
1895+ // (@interface func (export "downstream_bot_name")
1896+ // (param $req $request_handle)
1897+ // (param $bot_name_out (@witx pointer (@witx char8)))
1898+ // (param $bot_name_max_len (@witx usize))
1899+ // (param $nwritten_out (@witx pointer (@witx usize)))
1900+ // (result $err (expected (error $fastly_status)))
1901+ // )
1902+ //
1903+ //go:wasmimport fastly_http_downstream downstream_bot_name
1904+ //go:noescape
1905+ func fastlyHTTPReqDownstreamBotName (
1906+ req requestHandle ,
1907+ botNameOut prim.Pointer [prim.Char8 ],
1908+ botNameMaxLen prim.Usize ,
1909+ nwrittenOut prim.Pointer [prim.Usize ],
1910+ ) FastlyStatus
1911+
1912+ // DownstreamBotName returns the bot name detected
1913+ func (r * HTTPRequest ) DownstreamBotName () (string , error ) {
1914+ value , err := withAdaptiveBuffer (DefaultSmallBufLen , func (buf * prim.WriteBuffer ) FastlyStatus {
1915+ return fastlyHTTPReqDownstreamBotName (
1916+ r .h ,
1917+ prim .ToPointer (buf .Char8Pointer ()),
1918+ buf .Cap (),
1919+ prim .ToPointer (buf .NPointer ()),
1920+ )
1921+ })
1922+ if err != nil {
1923+ return "" , err
1924+ }
1925+ return value .ToString (), nil
1926+ }
1927+
1928+ // witx:
1929+ //
1930+ // (@interface func (export "downstream_bot_category")
1931+ // (param $req $request_handle)
1932+ // (param $bot_category_out (@witx pointer (@witx char8)))
1933+ // (param $bot_category_max_len (@witx usize))
1934+ // (param $nwritten_out (@witx pointer (@witx usize)))
1935+ // (result $err (expected (error $fastly_status)))
1936+ // )
1937+ //
1938+ //go:wasmimport fastly_http_downstream downstream_bot_category
1939+ //go:noescape
1940+ func fastlyHTTPReqDownstreamBotCategory (
1941+ req requestHandle ,
1942+ botCategoryOut prim.Pointer [prim.Char8 ],
1943+ botCategoryMaxLen prim.Usize ,
1944+ nwrittenOut prim.Pointer [prim.Usize ],
1945+ ) FastlyStatus
1946+
1947+ // DownstreamBotCategory returns the bot category
1948+ func (r * HTTPRequest ) DownstreamBotCategory () (string , error ) {
1949+ value , err := withAdaptiveBuffer (DefaultSmallBufLen , func (buf * prim.WriteBuffer ) FastlyStatus {
1950+ return fastlyHTTPReqDownstreamBotCategory (
1951+ r .h ,
1952+ prim .ToPointer (buf .Char8Pointer ()),
1953+ buf .Cap (),
1954+ prim .ToPointer (buf .NPointer ()),
1955+ )
1956+ })
1957+ if err != nil {
1958+ return "" , err
1959+ }
1960+ return value .ToString (), nil
1961+ }
1962+
1963+ // witx:
1964+ //
1965+ // (@interface func (export "downstream_bot_category_kind")
1966+ // (param $req $request_handle)
1967+ // (result $err (expected $bot_category_kind (error $fastly_status)))
1968+ // )
1969+ //
1970+ //go:wasmimport fastly_http_downstream downstream_bot_category_kind
1971+ //go:noescape
1972+ func fastlyHTTPDownstreamBotCategoryKind (
1973+ req requestHandle ,
1974+ kind prim.Pointer [prim.U32 ],
1975+ ) FastlyStatus
1976+
1977+ func (r * HTTPRequest ) DownstreamBotCategoryKind () (uint32 , error ) {
1978+ var kind prim.U32
1979+ if err := fastlyHTTPDownstreamBotCategoryKind (
1980+ r .h ,
1981+ prim .ToPointer (& kind ),
1982+ ).toError (); err != nil {
1983+ return 0 , err
1984+ }
1985+
1986+ return uint32 (kind ), nil
1987+ }
1988+
1989+ // witx:
1990+ //
1991+ // (@interface func (export "downstream_bot_verified")
1992+ //
1993+ // (param $req $request_handle)
1994+ // (result $err (expected $bot_verified (error $fastly_status)))
1995+ // )
1996+ //
1997+ //go:wasmimport fastly_http_downstream downstream_bot_verified
1998+ //go:noescape
1999+ func fastlyHTTPDownstreamBotVerified (
2000+ req requestHandle ,
2001+ analyzed prim.Pointer [bool ],
2002+ ) FastlyStatus
2003+
2004+ func (r * HTTPRequest ) DownstreamBotVerified () (bool , error ) {
2005+ var verified struct {
2006+ b bool
2007+ _ prim.Usize // align padding
2008+ }
2009+ if err := fastlyHTTPDownstreamBotVerified (
2010+ r .h ,
2011+ prim .ToPointer (& verified .b ),
2012+ ).toError (); err != nil {
2013+ return false , err
2014+ }
2015+
2016+ return verified .b , nil
2017+ }
2018+
18352019// witx:
18362020//
18372021// ;;; Hostcall for Fastly Compute guests to inspect request HTTP traffic
0 commit comments