File tree Expand file tree Collapse file tree 5 files changed +20
-0
lines changed Expand file tree Collapse file tree 5 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,9 @@ type Request interface {
121121 // Headers allows access to any incoming request headers.
122122 Headers () Header
123123
124+ // GetSourceAddr returns client SourceAddr.
125+ GetSourceAddr () string
126+
124127 // Body allows access to any incoming request body. To read this without
125128 // preventing the Next from reading it, enable FeatureBufferRequest.
126129 Body () Body
Original file line number Diff line number Diff line change @@ -178,3 +178,7 @@ func GetStatusCode() uint32 {
178178func SetStatusCode (statusCode uint32 ) {
179179 setStatusCode (statusCode )
180180}
181+
182+ func GetSourceAddr (ptr uint32 , limit BufLimit ) (len uint32 ) {
183+ return getSourceAddr (ptr , limit )
184+ }
Original file line number Diff line number Diff line change @@ -57,3 +57,6 @@ func getStatusCode() uint32
5757
5858//go:wasmimport http_handler set_status_code
5959func setStatusCode (statusCode uint32 )
60+
61+ //go:wasmimport http_handler get_source_addr
62+ func getSourceAddr (ptr uint32 , limit BufLimit ) (len uint32 )
Original file line number Diff line number Diff line change @@ -77,3 +77,8 @@ func getStatusCode() uint32 {
7777
7878// setStatusCode is stubbed for compilation outside TinyGo.
7979func setStatusCode (statusCode uint32 ) {}
80+
81+ // getSourceAddr is stubbed for compilation outside TinyGo.
82+ func getSourceAddr (ptr uint32 , limit BufLimit ) (len uint32 ) {
83+ return 0
84+ }
Original file line number Diff line number Diff line change @@ -57,3 +57,8 @@ func (wasmRequest) Body() api.Body {
5757func (wasmRequest ) Trailers () api.Header {
5858 return wasmRequestTrailers
5959}
60+
61+ // GetSourceAddr implements the same method as documented on api.Request.
62+ func (wasmRequest ) GetSourceAddr () string {
63+ return mem .GetString (imports .GetSourceAddr )
64+ }
You can’t perform that action at this time.
0 commit comments