Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implements Promise for dispatch callback #1377

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
262 changes: 262 additions & 0 deletions plugins/wasm-rust/examples/http-dispatch-example/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions plugins/wasm-rust/examples/http-dispatch-example/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "http-dispatch-example"
version = "0.1.0"
edition = "2021"
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
crate-type = ["cdylib"]

[dependencies]
higress-wasm-rust = { path = "../../", version = "0.1.0" }
proxy-wasm = { git="https://github.com/higress-group/proxy-wasm-rust-sdk", branch="main", version="0.2.2" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
11 changes: 11 additions & 0 deletions plugins/wasm-rust/examples/http-dispatch-example/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
BUILD_OPTS="--release"

.DEFAULT:
build:
rustup target add wasm32-wasi
cargo build --target wasm32-wasi ${BUILD_OPTS}
find target -name "*.wasm" -d 3 -exec cp "{}" plugin.wasm \;

clean:
cargo clean
rm -f plugin.wasm
26 changes: 26 additions & 0 deletions plugins/wasm-rust/examples/http-dispatch-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: http-dispatch-example
keywords:
description:
---

## 功能说明



## 运行属性

stage:`默认阶段`
level:`10`

### 配置说明

| Name | Type | Requirement | Default | Description |
| -------- | -------- | -------- | -------- | -------- |
| | | | | |

#### 配置示例

```yaml

```
26 changes: 26 additions & 0 deletions plugins/wasm-rust/examples/http-dispatch-example/README_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: http-dispatch-example
keywords:
description:
---

## Description



## Runtime

phase:`UNSPECIFIED_PHASE`
priority:`10`

### Config

| Name | Type | Requirement | Default | Description |
| -------- | -------- | -------- | -------- | -------- |
| | | | | |

#### Example

```yaml

```
1 change: 1 addition & 0 deletions plugins/wasm-rust/examples/http-dispatch-example/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (c) 2023 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

services:
envoy:
image: higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/all-in-one:latest
entrypoint: /usr/local/bin/envoy
command: -c /etc/envoy/envoy.yaml --component-log-level wasm:debug
depends_on:
- httpbin
hostname: envoy
ports:
- "10000:10000"
volumes:
- ./envoy.yaml:/etc/envoy/envoy.yaml
- ./plugin.wasm:/etc/envoy/plugin.wasm
networks:
- envoymesh
httpbin:
image: mccutchen/go-httpbin
hostname: httpbin
ports:
- "8080:8080"
networks:
- envoymesh
networks:
envoymesh: {}
Loading
Loading