hyperlane-macros
hyperlane macro.
Installation
To use this crate, you can run cmd:
cargo add hyperlane-macros
Available Macros
HTTP Method Macros
#[methods(method1, method2, ...)]
- Accepts multiple HTTP methods#[get]
- GET method handler#[post]
- POST method handler#[put]
- PUT method handler#[delete]
- DELETE method handler#[patch]
- PATCH method handler#[head]
- HEAD method handler#[options]
- OPTIONS method handler#[connect]
- CONNECT method handler#[trace]
- TRACE method handler
Protocol Check Macros
#[ws]
- WebSocket check#[http]
- HTTP check#[h2c]
- HTTP/2 Cleartext check#[http0_9]
- HTTP/0.9 check#[http1_0]
- HTTP/1.0 check#[http1_1]
- HTTP/1.1 check#[http1_1_or_higher]
- HTTP/1.1 or higher version check#[http2]
- HTTP/2 check#[http3]
- HTTP/3 check#[tls]
- TLS check
Response Setting Macros
#[status_code(code)]
- Set response status code#[reason_phrase("phrase")]
- Set response reason phrase
Send Operation Macros
#[send]
- Send response#[send_body]
- Send response body#[send_once]
- Send response once#[send_once_body]
- Send response body once
Filter Macros
#[filter_unknown_method]
- Filter unknown HTTP methods#[filter_unknown_upgrade]
- Filter unknown upgrade requests#[filter_unknown_version]
- Filter unknown HTTP versions#[filter_unknown]
- Combined filter for unknown method, upgrade, and version
Example Usage
use *;
async
async
async
async
async
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
Contact
For any inquiries, please reach out to the author at root@ltpp.vip.