mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-01 03:17:54 +00:00
http: takeover websocket feature from proxmox
adapted: use statements for proxmox::*, use statements for doctests Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
7b7e1413ff
commit
5153e68cab
@ -12,9 +12,17 @@ description = "Proxmox HTTP library"
|
|||||||
exclude = [ "debian" ]
|
exclude = [ "debian" ]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
anyhow = "1.0"
|
||||||
|
base64 = { version = "0.12", optional = true }
|
||||||
|
futures = { version = "0.3", optional = true }
|
||||||
|
hyper = { version = "0.14", features = [ "full" ], optional = true }
|
||||||
|
openssl = { version = "0.10", optional = true }
|
||||||
|
tokio = { version = "1.0", features = [], optional = true }
|
||||||
|
|
||||||
|
proxmox = { path = "../proxmox", optional = true, version = "0.11.3", default-features = false }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
|
||||||
client = []
|
client = []
|
||||||
websocket = []
|
websocket = [ "base64", "futures", "hyper", "openssl", "proxmox/tokio", "tokio/io-util", "tokio/sync" ]
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
#[cfg(feature = "websocket")]
|
||||||
|
pub mod websocket;
|
@ -22,8 +22,8 @@ use tokio::sync::mpsc;
|
|||||||
use futures::future::FutureExt;
|
use futures::future::FutureExt;
|
||||||
use futures::ready;
|
use futures::ready;
|
||||||
|
|
||||||
use crate::sys::error::io_err_other;
|
use proxmox::sys::error::io_err_other;
|
||||||
use crate::tools::byte_buffer::ByteBuffer;
|
use proxmox::tools::byte_buffer::ByteBuffer;
|
||||||
|
|
||||||
// see RFC6455 section 7.4.1
|
// see RFC6455 section 7.4.1
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
@ -146,7 +146,7 @@ fn mask_bytes(mask: Option<[u8; 4]>, data: &mut [u8]) {
|
|||||||
///
|
///
|
||||||
/// A normal Frame
|
/// A normal Frame
|
||||||
/// ```
|
/// ```
|
||||||
/// # use proxmox::tools::websocket::*;
|
/// # use proxmox_http::websocket::*;
|
||||||
/// # use std::io;
|
/// # use std::io;
|
||||||
/// # fn main() -> Result<(), WebSocketError> {
|
/// # fn main() -> Result<(), WebSocketError> {
|
||||||
/// let data = vec![0,1,2,3,4];
|
/// let data = vec![0,1,2,3,4];
|
||||||
@ -159,7 +159,7 @@ fn mask_bytes(mask: Option<[u8; 4]>, data: &mut [u8]) {
|
|||||||
///
|
///
|
||||||
/// A masked Frame
|
/// A masked Frame
|
||||||
/// ```
|
/// ```
|
||||||
/// # use proxmox::tools::websocket::*;
|
/// # use proxmox_http::websocket::*;
|
||||||
/// # use std::io;
|
/// # use std::io;
|
||||||
/// # fn main() -> Result<(), WebSocketError> {
|
/// # fn main() -> Result<(), WebSocketError> {
|
||||||
/// let data = vec![0,1,2,3,4];
|
/// let data = vec![0,1,2,3,4];
|
||||||
@ -172,7 +172,7 @@ fn mask_bytes(mask: Option<[u8; 4]>, data: &mut [u8]) {
|
|||||||
///
|
///
|
||||||
/// A ping Frame
|
/// A ping Frame
|
||||||
/// ```
|
/// ```
|
||||||
/// # use proxmox::tools::websocket::*;
|
/// # use proxmox_http::websocket::*;
|
||||||
/// # use std::io;
|
/// # use std::io;
|
||||||
/// # fn main() -> Result<(), WebSocketError> {
|
/// # fn main() -> Result<(), WebSocketError> {
|
||||||
/// let data = vec![0,1,2,3,4];
|
/// let data = vec![0,1,2,3,4];
|
||||||
@ -233,7 +233,7 @@ pub fn create_frame(
|
|||||||
///
|
///
|
||||||
/// Example usage:
|
/// Example usage:
|
||||||
/// ```
|
/// ```
|
||||||
/// # use proxmox::tools::websocket::*;
|
/// # use proxmox_http::websocket::*;
|
||||||
/// # use std::io;
|
/// # use std::io;
|
||||||
/// # use tokio::io::{AsyncWrite, AsyncWriteExt};
|
/// # use tokio::io::{AsyncWrite, AsyncWriteExt};
|
||||||
/// async fn code<I: AsyncWrite + Unpin>(writer: I) -> io::Result<()> {
|
/// async fn code<I: AsyncWrite + Unpin>(writer: I) -> io::Result<()> {
|
||||||
@ -352,7 +352,7 @@ impl FrameHeader {
|
|||||||
///
|
///
|
||||||
/// Example:
|
/// Example:
|
||||||
/// ```
|
/// ```
|
||||||
/// # use proxmox::tools::websocket::*;
|
/// # use proxmox_http::websocket::*;
|
||||||
/// # use std::io;
|
/// # use std::io;
|
||||||
/// # fn main() -> Result<(), WebSocketError> {
|
/// # fn main() -> Result<(), WebSocketError> {
|
||||||
/// let frame = create_frame(None, &[0,1,2,3], OpCode::Ping)?;
|
/// let frame = create_frame(None, &[0,1,2,3], OpCode::Ping)?;
|
@ -50,7 +50,7 @@ proxmox-api-macro = { path = "../proxmox-api-macro", optional = true, version =
|
|||||||
proxmox-sortable-macro = { path = "../proxmox-sortable-macro", optional = true, version = "0.1.1" }
|
proxmox-sortable-macro = { path = "../proxmox-sortable-macro", optional = true, version = "0.1.1" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = [ "cli", "router", "tfa", "u2f", "websocket" ]
|
default = [ "cli", "router", "tfa", "u2f" ]
|
||||||
sortable-macro = ["proxmox-sortable-macro"]
|
sortable-macro = ["proxmox-sortable-macro"]
|
||||||
|
|
||||||
# api:
|
# api:
|
||||||
@ -58,7 +58,6 @@ api-macro = ["proxmox-api-macro"]
|
|||||||
test-harness = []
|
test-harness = []
|
||||||
cli = [ "router", "hyper", "tokio" ]
|
cli = [ "router", "hyper", "tokio" ]
|
||||||
router = [ "futures", "hyper", "tokio" ]
|
router = [ "futures", "hyper", "tokio" ]
|
||||||
websocket = [ "futures", "hyper", "openssl", "tokio/sync", "tokio/io-util", "openssl" ]
|
|
||||||
tfa = [ "openssl" ]
|
tfa = [ "openssl" ]
|
||||||
u2f = [ "base32" ]
|
u2f = [ "base32" ]
|
||||||
|
|
||||||
|
@ -28,15 +28,12 @@ Build-Depends: debhelper (>= 11),
|
|||||||
librust-serde-json-1+default-dev <!nocheck>,
|
librust-serde-json-1+default-dev <!nocheck>,
|
||||||
librust-textwrap-0.11+default-dev <!nocheck>,
|
librust-textwrap-0.11+default-dev <!nocheck>,
|
||||||
librust-tokio-1+default-dev <!nocheck>,
|
librust-tokio-1+default-dev <!nocheck>,
|
||||||
librust-tokio-1+io-util-dev <!nocheck>,
|
|
||||||
librust-tokio-1+sync-dev <!nocheck>,
|
|
||||||
librust-url-2+default-dev (>= 2.1-~~) <!nocheck>,
|
librust-url-2+default-dev (>= 2.1-~~) <!nocheck>,
|
||||||
uuid-dev <!nocheck>,
|
uuid-dev <!nocheck>,
|
||||||
uuid-dev <!nocheck>,
|
uuid-dev <!nocheck>,
|
||||||
uuid-dev <!nocheck>,
|
uuid-dev <!nocheck>,
|
||||||
uuid-dev <!nocheck>,
|
uuid-dev <!nocheck>,
|
||||||
uuid-dev <!nocheck>,
|
uuid-dev <!nocheck>,
|
||||||
uuid-dev <!nocheck>,
|
|
||||||
uuid-dev <!nocheck>
|
uuid-dev <!nocheck>
|
||||||
Maintainer: Proxmox Support Team <support@proxmox.com>
|
Maintainer: Proxmox Support Team <support@proxmox.com>
|
||||||
Standards-Version: 4.4.1
|
Standards-Version: 4.4.1
|
||||||
@ -79,8 +76,7 @@ Suggests:
|
|||||||
librust-proxmox+proxmox-sortable-macro-dev (= ${binary:Version}),
|
librust-proxmox+proxmox-sortable-macro-dev (= ${binary:Version}),
|
||||||
librust-proxmox+router-dev (= ${binary:Version}),
|
librust-proxmox+router-dev (= ${binary:Version}),
|
||||||
librust-proxmox+tokio-dev (= ${binary:Version}),
|
librust-proxmox+tokio-dev (= ${binary:Version}),
|
||||||
librust-proxmox+tokio-stream-dev (= ${binary:Version}),
|
librust-proxmox+tokio-stream-dev (= ${binary:Version})
|
||||||
librust-proxmox+websocket-dev (= ${binary:Version})
|
|
||||||
Provides:
|
Provides:
|
||||||
librust-proxmox+test-harness-dev (= ${binary:Version}),
|
librust-proxmox+test-harness-dev (= ${binary:Version}),
|
||||||
librust-proxmox-0-dev (= ${binary:Version}),
|
librust-proxmox-0-dev (= ${binary:Version}),
|
||||||
@ -162,8 +158,7 @@ Depends:
|
|||||||
librust-proxmox+cli-dev (= ${binary:Version}),
|
librust-proxmox+cli-dev (= ${binary:Version}),
|
||||||
librust-proxmox+router-dev (= ${binary:Version}),
|
librust-proxmox+router-dev (= ${binary:Version}),
|
||||||
librust-proxmox+tfa-dev (= ${binary:Version}),
|
librust-proxmox+tfa-dev (= ${binary:Version}),
|
||||||
librust-proxmox+u2f-dev (= ${binary:Version}),
|
librust-proxmox+u2f-dev (= ${binary:Version})
|
||||||
librust-proxmox+websocket-dev (= ${binary:Version})
|
|
||||||
Provides:
|
Provides:
|
||||||
librust-proxmox-0+default-dev (= ${binary:Version}),
|
librust-proxmox-0+default-dev (= ${binary:Version}),
|
||||||
librust-proxmox-0.11+default-dev (= ${binary:Version}),
|
librust-proxmox-0.11+default-dev (= ${binary:Version}),
|
||||||
@ -308,23 +303,3 @@ Provides:
|
|||||||
Description: Proxmox library - feature "tokio-stream"
|
Description: Proxmox library - feature "tokio-stream"
|
||||||
This metapackage enables feature "tokio-stream" for the Rust proxmox crate, by
|
This metapackage enables feature "tokio-stream" for the Rust proxmox crate, by
|
||||||
pulling in any additional dependencies needed by that feature.
|
pulling in any additional dependencies needed by that feature.
|
||||||
|
|
||||||
Package: librust-proxmox+websocket-dev
|
|
||||||
Architecture: any
|
|
||||||
Multi-Arch: same
|
|
||||||
Depends:
|
|
||||||
${misc:Depends},
|
|
||||||
librust-proxmox-dev (= ${binary:Version}),
|
|
||||||
librust-futures-0.3+default-dev,
|
|
||||||
librust-hyper-0.14+default-dev,
|
|
||||||
librust-hyper-0.14+full-dev,
|
|
||||||
librust-openssl-0.10+default-dev,
|
|
||||||
librust-tokio-1+io-util-dev,
|
|
||||||
librust-tokio-1+sync-dev
|
|
||||||
Provides:
|
|
||||||
librust-proxmox-0+websocket-dev (= ${binary:Version}),
|
|
||||||
librust-proxmox-0.11+websocket-dev (= ${binary:Version}),
|
|
||||||
librust-proxmox-0.11.4+websocket-dev (= ${binary:Version})
|
|
||||||
Description: Proxmox library - feature "websocket"
|
|
||||||
This metapackage enables feature "websocket" for the Rust proxmox crate, by
|
|
||||||
pulling in any additional dependencies needed by that feature.
|
|
||||||
|
@ -21,9 +21,6 @@ pub mod time;
|
|||||||
pub mod uuid;
|
pub mod uuid;
|
||||||
pub mod vec;
|
pub mod vec;
|
||||||
|
|
||||||
#[cfg(feature = "websocket")]
|
|
||||||
pub mod websocket;
|
|
||||||
|
|
||||||
#[cfg(feature = "tfa")]
|
#[cfg(feature = "tfa")]
|
||||||
pub mod tfa;
|
pub mod tfa;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user