remove proxmox crate (no longer used)
Most functionality is now in proxmox-sys. The common-regex.rs is moved back into proxmox-backup-server, because it is only used there. Serde code is now in new proxmox-serde crate. Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
parent
82245339b8
commit
d357ce2070
@ -1,6 +1,5 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"proxmox",
|
||||
"proxmox-api-macro",
|
||||
"proxmox-async",
|
||||
"proxmox-borrow",
|
||||
|
1
Makefile
1
Makefile
@ -1,7 +1,6 @@
|
||||
# Shortcut for common operations:
|
||||
|
||||
CRATES = \
|
||||
proxmox \
|
||||
proxmox-api-macro \
|
||||
proxmox-async \
|
||||
proxmox-borrow \
|
||||
|
@ -1,22 +0,0 @@
|
||||
[package]
|
||||
name = "proxmox"
|
||||
edition = "2018"
|
||||
version = "0.16.0"
|
||||
authors = [
|
||||
"Dietmar Maurer <dietmar@proxmox.com>",
|
||||
"Wolfgang Bumiller <w.bumiller@proxmox.com>",
|
||||
]
|
||||
license = "AGPL-3"
|
||||
description = "Generic Proxmox library"
|
||||
|
||||
exclude = [ "debian" ]
|
||||
|
||||
[dependencies]
|
||||
# General dependencies
|
||||
anyhow = "1.0"
|
||||
lazy_static = "1.4"
|
||||
|
||||
# tools module:
|
||||
regex = "1.2"
|
||||
|
||||
proxmox-io = { path = "../proxmox-io", version = "1.0.0" }
|
@ -1,786 +0,0 @@
|
||||
rust-proxmox (0.16.0-1) unstable; urgency=medium
|
||||
|
||||
* moved most code to proxmox-sys
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 23 Nov 2021 11:32:39 +0100
|
||||
|
||||
rust-proxmox (0.15.4-1) stable; urgency=medium
|
||||
|
||||
* rebuild with base64 0.13
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 19 Nov 2021 09:57:00 +0100
|
||||
|
||||
rust-proxmox (0.15.3-1) unstable; urgency=medium
|
||||
|
||||
* proxmox: add fd_change_cloexec
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 18 Nov 2021 13:08:10 +0100
|
||||
|
||||
rust-proxmox (0.15.2-1) stable; urgency=medium
|
||||
|
||||
* impl proxmox::tools::fs::CreateOptions::apply_to()
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 12 Nov 2021 17:37:33 +0100
|
||||
|
||||
rust-proxmox (0.15.1-1) unstable; urgency=medium
|
||||
|
||||
* fix error handling if the previously introduced fsyncs fail
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 21 Oct 2021 12:40:52 +0200
|
||||
|
||||
rust-proxmox (0.15.0-0) unstable; urgency=medium
|
||||
|
||||
* add fsync parameter to replace_file and atomic_open_or_create
|
||||
|
||||
* add filename completions helper (moved from pbs-tools)
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 21 Oct 2021 07:02:17 +0200
|
||||
|
||||
rust-proxmox (0.14.0-1) stable; urgency=medium
|
||||
|
||||
* remove several modules moved into their own crates:
|
||||
- borrow
|
||||
- io
|
||||
- lang
|
||||
- router
|
||||
- schema
|
||||
- section-config
|
||||
- tfa
|
||||
- time
|
||||
- uuid
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 08 Oct 2021 08:37:11 +0200
|
||||
|
||||
rust-proxmox (0.13.5-1) stable; urgency=medium
|
||||
|
||||
* ParameterError: record parameter names
|
||||
|
||||
* cli/text_table: calculate correct column width for unicode characters
|
||||
|
||||
* upid: remove arbitrary 128 max length for UPID
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 28 Sep 2021 08:31:39 +0200
|
||||
|
||||
rust-proxmox (0.13.4-1) stable; urgency=medium
|
||||
|
||||
* add UPID api type
|
||||
|
||||
* add systemd escape_unit and unescape_unit
|
||||
|
||||
* schema: add extra info to array parameters
|
||||
|
||||
* schema: print item type-text instead of <array>
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 23 Sep 2021 12:06:08 +0200
|
||||
|
||||
rust-proxmox (0.13.3-1) unstable; urgency=medium
|
||||
|
||||
* atomic_open_or_create_file: add support for OFlag::O_EXCL
|
||||
|
||||
* atomic_open_or_create_file: catch unsupported flag OFlag::O_DIRECTORY
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 21 Sep 2021 06:42:41 +0200
|
||||
|
||||
rust-proxmox (0.13.2-1) stable; urgency=medium
|
||||
|
||||
* impl <T: UserInformation> UserInformation for std::sync::Arc<T>
|
||||
|
||||
* generate_usage_str: don't require static lifetimes
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 16 Sep 2021 11:03:02 +0200
|
||||
|
||||
rust-proxmox (0.13.1-1) stable; urgency=medium
|
||||
|
||||
* fix UpdaterType documentation
|
||||
|
||||
* move `ReturnType` from `api::router` to `api::schema`
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 30 Aug 2021 10:45:25 +0200
|
||||
|
||||
rust-proxmox (0.13.0-1) stable; urgency=medium
|
||||
|
||||
* introduce ApiType trait with a `const API_SCHEMA: Schema`, all API types
|
||||
should implement this
|
||||
|
||||
* Rename `Updatable` to `UpdaterType` and drop `UPDATER_IS_OPTION` from it
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 24 Aug 2021 15:20:24 +0200
|
||||
|
||||
rust-proxmox (0.12.1-1) stable; urgency=medium
|
||||
|
||||
* fs: fallback to link if renameat2 is not supported in atomic file creation
|
||||
helper
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 22 Jul 2021 09:47:45 +0200
|
||||
|
||||
rust-proxmox (0.12.0-1) stable; urgency=medium
|
||||
|
||||
* open_file_locked: add options parameter (CreateOptions)
|
||||
|
||||
* new helper atomic_open_or_create_file()
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 20 Jul 2021 10:24:34 +0200
|
||||
|
||||
rust-proxmox (0.11.6-1) stable; urgency=medium
|
||||
|
||||
* make_tmp_file: return File instead of Fd
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 14 Jul 2021 12:31:34 +0200
|
||||
|
||||
rust-proxmox (0.11.5-1) stable; urgency=medium
|
||||
|
||||
* takeover socket helper from proxmox_backup
|
||||
|
||||
* http: takeover websocket feature from proxmox
|
||||
|
||||
* add missing +router -> futures dep
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 17 May 2021 10:06:59 +0200
|
||||
|
||||
rust-proxmox (0.11.4-1) stable; urgency=medium
|
||||
|
||||
* fix #3302: allow for more characters for email
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 14 May 2021 12:10:32 +0200
|
||||
|
||||
rust-proxmox (0.11.3-1) unstable; urgency=medium
|
||||
|
||||
* add api_string_type macro
|
||||
|
||||
* simplify const_regex macro
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 05 May 2021 07:47:01 +0200
|
||||
|
||||
rust-proxmox (0.11.2-1) unstable; urgency=medium
|
||||
|
||||
* proxmox/api/cli: add extract_output_format
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 03 May 2021 08:04:26 +0200
|
||||
|
||||
rust-proxmox (0.11.1) unstable; urgency=medium
|
||||
|
||||
* enable Updater for usize, isize, f32, f64, char
|
||||
|
||||
* add string_as_base64url_nopad to tools::serde
|
||||
|
||||
* bump api-macro dep to 0.3.4
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 14 Apr 2021 12:00:45 +0200
|
||||
|
||||
rust-proxmox (0.11.0-1) unstable; urgency=medium
|
||||
|
||||
* fix some issues with nested AllOfSchemas
|
||||
|
||||
* remove associated type PropertyIter from ObjectSchemaType trait
|
||||
|
||||
* support AllOf schemas in SectionConfig
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 25 Feb 2021 09:18:18 +0100
|
||||
|
||||
rust-proxmox (0.10.7-1) unstable; urgency=medium
|
||||
|
||||
* add test submodule
|
||||
|
||||
* add tools::io::sparse_copy and sparse_copy_async
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 23 Feb 2021 14:38:03 +0100
|
||||
|
||||
rust-proxmox (0.10.6-1) unstable; urgency=medium
|
||||
|
||||
* make get_property_string_type_text public
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Sun, 21 Feb 2021 15:45:54 +0100
|
||||
|
||||
rust-proxmox (0.10.5-1) unstable; urgency=medium
|
||||
|
||||
* implement dump_section_config
|
||||
|
||||
* rename dump_api_parameters to dump_properties
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 11 Feb 2021 10:45:33 +0100
|
||||
|
||||
rust-proxmox (0.10.4-1) unstable; urgency=medium
|
||||
|
||||
* bump api macro dep to 0.3.2
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 10 Feb 2021 10:17:38 +0100
|
||||
|
||||
rust-proxmox (0.10.3-1) unstable; urgency=medium
|
||||
|
||||
* api: implement schema doc generator for PropertyStrings
|
||||
|
||||
* api: improve reST formating
|
||||
|
||||
* api: add dump_enum_properties(), make dump_api_parameter pub
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 10 Feb 2021 10:13:04 +0100
|
||||
|
||||
rust-proxmox (0.10.2-1) unstable; urgency=medium
|
||||
|
||||
* CliCommandMap: add usage_skip_options to suppress options in
|
||||
generate_usage_str()
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 05 Feb 2021 12:27:57 +0100
|
||||
|
||||
rust-proxmox (0.10.1-1) unstable; urgency=medium
|
||||
|
||||
* cli: improve completion of array arguments
|
||||
|
||||
* clippy fixes
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 03 Feb 2021 08:31:05 +0100
|
||||
|
||||
rust-proxmox (0.10.0-1) unstable; urgency=medium
|
||||
|
||||
* time: fix parsing non-full-hour TZ offsets
|
||||
|
||||
* update to rustyline 7
|
||||
|
||||
* update to tokio 1.0
|
||||
|
||||
* tokio 1.0: drop TimeoutFutureExt
|
||||
|
||||
* move ParameterSchema from router to schema
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 14 Jan 2021 15:31:27 +0100
|
||||
|
||||
rust-proxmox (0.9.1-1) unstable; urgency=medium
|
||||
|
||||
* add tools::future with TimeoutFutureExt
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 22 Dec 2020 13:25:25 +0100
|
||||
|
||||
rust-proxmox (0.9.0-2) unstable; urgency=medium
|
||||
|
||||
* correctly depend on proxmox-api-macro 0.3
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 22 Dec 2020 08:05:44 +0100
|
||||
|
||||
rust-proxmox (0.9.0-1) unstable; urgency=medium
|
||||
|
||||
* `ApiMethod.returns` is now a `router::ReturnType` rather than a direct
|
||||
`&Schema` reference and can be marked as `optional`.
|
||||
|
||||
* Added an `AllOfSchema` (`Schema::AllOf`) where multiple object schemas can
|
||||
be combined like with JSONSchema/openapi's `allOf` property.
|
||||
|
||||
* `ApiMethod.parameters` is now a `ParameterSchema` instead of simply an
|
||||
`ObjectSchema`.
|
||||
|
||||
* There's now an `ObjectSchemaType` trait implemented by `ObjectSchema`,
|
||||
`AllOfSchema` as well as `ParameterSchema` for simplicity. Some of the
|
||||
verifiers/parsers now use the trait to cope with both types with minimal
|
||||
changes.
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 11 Dec 2020 14:55:29 +0100
|
||||
|
||||
rust-proxmox (0.8.1-1) unstable; urgency=medium
|
||||
|
||||
* trait ReadExt: add read_exact_or_eof and skip_to_end
|
||||
|
||||
* fix example array in Cargo.toml
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Sun, 06 Dec 2020 09:07:45 +0100
|
||||
|
||||
rust-proxmox (0.8.0-1) unstable; urgency=medium
|
||||
|
||||
* `make_tmp_file` now returns a guarded `Fd` instead of a `RawFd`
|
||||
|
||||
* introduced `FdRef` and `BorrowedFd` helper types
|
||||
|
||||
* clippy lint and formatting fixups
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 30 Nov 2020 11:14:43 +0100
|
||||
|
||||
rust-proxmox (0.7.2-1) unstable; urgency=medium
|
||||
|
||||
* implement cli command alias feature
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 24 Nov 2020 13:23:43 +0100
|
||||
|
||||
rust-proxmox (0.7.1-1) unstable; urgency=medium
|
||||
|
||||
* fix tracking of subcommand prefix in order to produce correct help output
|
||||
on errors
|
||||
|
||||
* u2f: make certificate optional
|
||||
|
||||
* u2f: make AuthResponse fields pub
|
||||
|
||||
* u2f: impl Deserialize for registration challenge
|
||||
|
||||
* add tools::hex_to_bin_exact
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 19 Nov 2020 08:54:26 +0100
|
||||
|
||||
rust-proxmox (0.7.0-1) unstable; urgency=medium
|
||||
|
||||
* rename 'step' to 'period' in totp values
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 30 Oct 2020 15:14:41 +0100
|
||||
|
||||
rust-proxmox (0.6.0-1) unstable; urgency=medium
|
||||
|
||||
* fix a case where use of the api attribute macro can generate unused
|
||||
variable warnings
|
||||
|
||||
* RpcEnvironment: rename user to auth_id
|
||||
|
||||
* add proxmox::tools::tfa for totp and u2f implementations
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 29 Oct 2020 15:02:38 +0100
|
||||
|
||||
rust-proxmox (0.5.0-1) unstable; urgency=medium
|
||||
|
||||
* bump nix dependency to 0.19
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 19 Oct 2020 12:29:55 +0200
|
||||
|
||||
rust-proxmox (0.4.4-1) unstable; urgency=medium
|
||||
|
||||
* api: RPC environment: add client IP getter/setter to trait
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 16 Oct 2020 10:30:07 +0200
|
||||
|
||||
rust-proxmox (0.4.3-1) unstable; urgency=medium
|
||||
|
||||
* tools: change constnamemap to a more automatic constnamedbitmap
|
||||
|
||||
* improve error messages in parse_rfc3339
|
||||
|
||||
* big formatting cleanup
|
||||
|
||||
* proxmox/tools/common_regex: improve IPRE_BRACKET
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 08 Oct 2020 09:00:09 +0200
|
||||
|
||||
rust-proxmox (0.4.2-1) unstable; urgency=medium
|
||||
|
||||
* add exclusive parameter to open_file_locked
|
||||
|
||||
* proxmox/tools/fs: create tmpfile helper
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 28 Sep 2020 10:05:00 +0200
|
||||
|
||||
rust-proxmox (0.4.1-1) unstable; urgency=medium
|
||||
|
||||
* proxmox/src/tools/email.rs: use slice instead of Vec
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 21 Sep 2020 10:22:31 +0200
|
||||
|
||||
rust-proxmox (0.4.0-1) unstable; urgency=medium
|
||||
|
||||
* permissions: introduce UserParam permission
|
||||
|
||||
* bump api-macro dependency to 0.2.2
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Sat, 19 Sep 2020 06:27:18 +0200
|
||||
|
||||
rust-proxmox (0.3.9-1) unstable; urgency=medium
|
||||
|
||||
* bump api-macro dependency to 0.2.1
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 17 Sep 2020 08:32:14 +0200
|
||||
|
||||
rust-proxmox (0.3.8-1) unstable; urgency=medium
|
||||
|
||||
* remove chrono dependency and related code
|
||||
|
||||
* check year in epoch_to_rfc3339, new helpers strftime_local and
|
||||
strftime_utc
|
||||
|
||||
* new helpers epoch_i64 and epoch_f64
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 14 Sep 2020 13:40:54 +0200
|
||||
|
||||
rust-proxmox (0.3.7-1) unstable; urgency=medium
|
||||
|
||||
* implement epoch_as_rfc3339 serializer
|
||||
|
||||
* email.rs: avoid chrono dependency
|
||||
|
||||
* time.rs: add epoch_to_rfc_3339 and parse_rfc_3339
|
||||
|
||||
* tm_editor.rs: copied from proxmox backup
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Sun, 13 Sep 2020 16:15:31 +0200
|
||||
|
||||
rust-proxmox (0.3.6-1) unstable; urgency=medium
|
||||
|
||||
* proxmox/src/tools/time.rs: add strftime bindings
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Sat, 12 Sep 2020 15:01:01 +0200
|
||||
|
||||
rust-proxmox (0.3.5-1) unstable; urgency=medium
|
||||
|
||||
* tools/time: give tm struct as mut reference
|
||||
|
||||
* and run rustfmt over another big chunk of code, formatting fixups
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 04 Sep 2020 06:36:31 +0200
|
||||
|
||||
rust-proxmox (0.3.4-1) unstable; urgency=medium
|
||||
|
||||
* email: add small function to send multi-part emails using sendmail
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 28 Aug 2020 06:24:56 +0200
|
||||
|
||||
rust-proxmox (0.3.3-1) unstable; urgency=medium
|
||||
|
||||
* add forward_deserialize_to_from_str
|
||||
|
||||
* add forward_serialize_to_display
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 10 Aug 2020 11:30:12 +0200
|
||||
|
||||
rust-proxmox (0.3.2-1) unstable; urgency=medium
|
||||
|
||||
* add proxmox::sys::timer
|
||||
|
||||
* add proxmox::tools::fs::lock_file
|
||||
|
||||
* add proxmox::tools::fs::open_file_locked
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 04 Aug 2020 11:10:34 +0200
|
||||
|
||||
rust-proxmox (0.3.1-1) unstable; urgency=medium
|
||||
|
||||
* Uuid: implement Serlialize/Deserialize
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Sun, 02 Aug 2020 11:51:35 +0200
|
||||
|
||||
rust-proxmox (0.3.0-1) unstable; urgency=medium
|
||||
|
||||
* change http_err macro to imply formatting and add http_bail macro
|
||||
|
||||
* fix #2882: fix parsing of optional fields in mountinfo
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 29 Jul 2020 09:35:50 +0200
|
||||
|
||||
rust-proxmox (0.2.1-1) unstable; urgency=medium
|
||||
|
||||
* improve byte buffer
|
||||
|
||||
* add WebSocket implementation
|
||||
|
||||
* improve error handling and clippy lint fixes
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 23 Jul 2020 12:03:44 +0200
|
||||
|
||||
rust-proxmox (0.2.0-1) unstable; urgency=medium
|
||||
|
||||
* bump api-macro dependency to 0.2.0
|
||||
|
||||
* cleanup ByteBuffer API and docs
|
||||
|
||||
* fix utf-8 handling in bash completion
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 10 Jul 2020 10:58:30 +0200
|
||||
|
||||
rust-proxmox (0.1.42-1) unstable; urgency=medium
|
||||
|
||||
* tools: add Websocket helper
|
||||
|
||||
* sys/linux: add PTY helper
|
||||
|
||||
* tools: add ByteBuffer
|
||||
|
||||
* cleanup: libc has 'getrandom' since 0.2.59
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 03 Jul 2020 13:00:44 +0200
|
||||
|
||||
rust-proxmox (0.1.41-1) unstable; urgency=medium
|
||||
|
||||
* api/router: percent decode the components of the uri
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 26 Jun 2020 10:36:14 +0200
|
||||
|
||||
rust-proxmox (0.1.40-1) unstable; urgency=medium
|
||||
|
||||
* use tty for prompt when reading passwords to not clobber redirected stdout
|
||||
|
||||
* introduce AsHex helper for displaying byte slices as hex
|
||||
|
||||
* add Mmap helper for memory mapped slices or raw data
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 12 Jun 2020 13:54:49 +0200
|
||||
|
||||
rust-proxmox (0.1.39-1) unstable; urgency=medium
|
||||
|
||||
* fix Permission::Privilege path check
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 05 Jun 2020 07:26:46 +0200
|
||||
|
||||
rust-proxmox (0.1.38-1) unstable; urgency=medium
|
||||
|
||||
* tools/fs.rs: add additional helpers to get file contents
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 28 May 2020 09:51:08 +0200
|
||||
|
||||
rust-proxmox (0.1.37-1) unstable; urgency=medium
|
||||
|
||||
* proxmox: add string_as_base64 serde (de)serializer
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 26 May 2020 12:54:36 +0200
|
||||
|
||||
rust-proxmox (0.1.36-1) unstable; urgency=medium
|
||||
|
||||
* procfs: fixup iowait_percent
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 25 May 2020 12:11:50 +0200
|
||||
|
||||
rust-proxmox (0.1.35-1) unstable; urgency=medium
|
||||
|
||||
* procfs: add loadavg
|
||||
|
||||
* procfs: don't count guest and guest_nice times twice in cpu usage
|
||||
calculation
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 25 May 2020 11:10:28 +0200
|
||||
|
||||
rust-proxmox (0.1.34-1) unstable; urgency=medium
|
||||
|
||||
* add 'constnamemap' macro
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 20 May 2020 13:16:58 +0200
|
||||
|
||||
rust-proxmox (0.1.33-1) unstable; urgency=medium
|
||||
|
||||
* section_config: fixup fallback schema in parse
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 20 May 2020 06:26:18 +0200
|
||||
|
||||
rust-proxmox (0.1.32-1) unstable; urgency=medium
|
||||
|
||||
* section_config: add convert_to_typed_array
|
||||
|
||||
* add id_property to SectionConfigPlugin
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 19 May 2020 09:50:55 +0200
|
||||
|
||||
rust-proxmox (0.1.31-1) unstable; urgency=medium
|
||||
|
||||
* rpc_environment.rs: use Value to store metadata
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 18 May 2020 09:49:46 +0200
|
||||
|
||||
rust-proxmox (0.1.30-1) unstable; urgency=medium
|
||||
|
||||
* add bindings for libc localtime/timelocal
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 15 May 2020 17:42:48 +0200
|
||||
|
||||
rust-proxmox (0.1.29-1) unstable; urgency=medium
|
||||
|
||||
* section_config.rs: make record_order public
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 12 May 2020 12:57:38 +0200
|
||||
|
||||
rust-proxmox (0.1.28-1) unstable; urgency=medium
|
||||
|
||||
* section_config add support for systemd config files
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 12 May 2020 09:15:23 +0200
|
||||
|
||||
rust-proxmox (0.1.27-1) unstable; urgency=medium
|
||||
|
||||
* schema: split property string lists with comma, semicolon and white space.
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 08 May 2020 08:07:31 +0200
|
||||
|
||||
rust-proxmox (0.1.26-1) unstable; urgency=medium
|
||||
|
||||
* run_cli_command: add additional rpcenv parameter
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 06 May 2020 12:28:02 +0200
|
||||
|
||||
rust-proxmox (0.1.25-1) unstable; urgency=medium
|
||||
|
||||
* add descriptions to enum variants
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 29 Apr 2020 10:45:24 +0200
|
||||
|
||||
rust-proxmox (0.1.24-1) unstable; urgency=medium
|
||||
|
||||
* section_config.rs - convert_to_array: remove static lifetime
|
||||
|
||||
* text_table.rs - format_object: skip optional properties without data
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 28 Apr 2020 08:16:28 +0200
|
||||
|
||||
rust-proxmox (0.1.23-1) unstable; urgency=medium
|
||||
|
||||
* api/cli/command.rs: handle fixed_param
|
||||
|
||||
* tools: add RawFdNum helper
|
||||
|
||||
* api/cli/completion.rs: implement completion for lists of strings
|
||||
|
||||
* IP_REGEX - match whole string
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Sat, 25 Apr 2020 17:04:19 +0200
|
||||
|
||||
rust-proxmox (0.1.22-1) unstable; urgency=medium
|
||||
|
||||
* replace failure with anyhow crate
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 17 Apr 2020 18:36:52 +0200
|
||||
|
||||
rust-proxmox (0.1.21-1) unstable; urgency=medium
|
||||
|
||||
* add access permission framework
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 16 Apr 2020 08:26:41 +0200
|
||||
|
||||
rust-proxmox (0.1.20-1) unstable; urgency=medium
|
||||
|
||||
* improve command line completion with optional argument parameters
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 25 Mar 2020 10:56:08 +0100
|
||||
|
||||
rust-proxmox (0.1.19-1) unstable; urgency=medium
|
||||
|
||||
* remove superfluous newlines in cli help output
|
||||
|
||||
* bump api macro to 0.1.5: add implicit minimum/maximum to integer types
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 19 Mar 2020 09:59:58 +0100
|
||||
|
||||
rust-proxmox (0.1.18-1) unstable; urgency=medium
|
||||
|
||||
* Added SectionConfig (moved from proxmox-backup)
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 02 Mar 2020 12:48:08 +0100
|
||||
|
||||
rust-proxmox (0.1.17-1) unstable; urgency=medium
|
||||
|
||||
* improve text-table output formatting
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 28 Feb 2020 10:07:56 +0100
|
||||
|
||||
rust-proxmox (0.1.16-1) unstable; urgency=medium
|
||||
|
||||
* bump api-macro dependency to 0.1.4
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 27 Feb 2020 13:11:58 +0100
|
||||
|
||||
rust-proxmox (0.1.15-1) unstable; urgency=medium
|
||||
|
||||
* text_table.rs: new helpers to read output format from environment
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 27 Feb 2020 12:36:43 +0100
|
||||
|
||||
rust-proxmox (0.1.14-1) unstable; urgency=medium
|
||||
|
||||
* improve cli table formatter
|
||||
|
||||
* verify_json_object: improve error message
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 27 Feb 2020 11:16:44 +0100
|
||||
|
||||
rust-proxmox (0.1.13-1) unstable; urgency=medium
|
||||
|
||||
* src/sys/linux/tty.rs: add tty helpers
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 31 Jan 2020 08:03:46 +0100
|
||||
|
||||
rust-proxmox (0.1.12-1) unstable; urgency=medium
|
||||
|
||||
* src/api/cli/text_table.rs: only call TIOCGWINSZ on terminals
|
||||
|
||||
* src/api/cli/text_table.rs - TableFormatOptions: allow to add
|
||||
single column configs
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 31 Jan 2020 06:52:55 +0100
|
||||
|
||||
rust-proxmox (0.1.11-1) unstable; urgency=medium
|
||||
|
||||
* bump api-macro dependency version
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 30 Jan 2020 12:46:01 +0100
|
||||
|
||||
rust-proxmox (0.1.10-1) unstable; urgency=medium
|
||||
|
||||
* implement text table formatter
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 30 Jan 2020 11:45:38 +0100
|
||||
|
||||
rust-proxmox (0.1.9-1) unstable; urgency=medium
|
||||
|
||||
* cli command helper: imple sync and async versions
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 27 Jan 2020 18:03:36 +0100
|
||||
|
||||
rust-proxmox (0.1.8-1) unstable; urgency=medium
|
||||
|
||||
* bump api macro to 0.1.2: fix a case were object properties weren't sorted
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 23 Jan 2020 13:17:20 +0100
|
||||
|
||||
rust-proxmox (0.1.7-1) unstable; urgency=medium
|
||||
|
||||
* disable valgrind features for now due to packaging issues
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 21 Jan 2020 12:23:58 +0100
|
||||
|
||||
rust-proxmox (0.1.6-1) unstable; urgency=medium
|
||||
|
||||
* merge tools, sys and api crate into the proxmox main crate to reduce
|
||||
the dependency management burden
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 21 Jan 2020 12:19:32 +0100
|
||||
|
||||
rust-proxmox (0.1.5-1) unstable; urgency=medium
|
||||
|
||||
* src/cli/command.rs: avoid creating a tokio runtime by making
|
||||
run_cli_command async
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 21 Jan 2020 11:18:29 +0100
|
||||
|
||||
rust-proxmox (0.1.4-1) unstable; urgency=medium
|
||||
|
||||
* sys: rename PidStat::read_for_pid -> read_from_pid
|
||||
|
||||
* sys: drop deprecated items
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 16 Jan 2020 11:34:29 +0100
|
||||
|
||||
rust-proxmox (0.1.3-1) unstable; urgency=medium
|
||||
|
||||
* proxmox-tools: bump to 0.1.2
|
||||
|
||||
* proxmox-api: bump to 0.1.2
|
||||
|
||||
* bump proxmox-sys to 0.1.2
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 15 Jan 2020 15:32:29 +0100
|
||||
|
||||
rust-proxmox (0.1.2-1) proxmox-rust; urgency=medium
|
||||
|
||||
* switch packaging to debcargo with local crate support
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 13 Jan 2020 10:41:01 +0100
|
||||
|
||||
rust-proxmox (0.1.2) proxmox-rust; urgency=medium
|
||||
|
||||
* api-macro: bump to 0.1.1
|
||||
|
||||
* api-macro: cover all the basic struct support in the #[api] macro
|
||||
|
||||
* api-macro: support #[serde(rename_all)] on enums and structs
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 08 Jan 2020 14:12:57 +0100
|
||||
|
||||
rust-proxmox (0.1.1) proxmox-rust; urgency=medium
|
||||
|
||||
* proxmox-sys: added: helpers for dealing with nix and io errors
|
||||
|
||||
* dependency updates
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 02 Jan 2020 14:21:56 +0100
|
||||
|
||||
rust-proxmox (0.1.0) proxmox-rust; urgency=medium
|
||||
|
||||
* Initial packaging.
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 17 Dec 2019 13:50:53 +0100
|
@ -1,103 +0,0 @@
|
||||
Source: rust-proxmox
|
||||
Section: rust
|
||||
Priority: optional
|
||||
Build-Depends: debhelper (>= 12),
|
||||
dh-cargo (>= 24),
|
||||
cargo:native <!nocheck>,
|
||||
rustc:native <!nocheck>,
|
||||
libstd-rust-dev <!nocheck>,
|
||||
librust-anyhow-1+default-dev <!nocheck>,
|
||||
librust-base64-0.13+default-dev <!nocheck>,
|
||||
librust-endian-trait-0.6+arrays-dev <!nocheck>,
|
||||
librust-endian-trait-0.6+default-dev <!nocheck>,
|
||||
librust-lazy-static-1+default-dev (>= 1.4-~~) <!nocheck>,
|
||||
librust-libc-0.2+default-dev <!nocheck>,
|
||||
librust-nix-0.19+default-dev (>= 0.19.1-~~) <!nocheck>,
|
||||
librust-proxmox-io-1+default-dev <!nocheck>,
|
||||
librust-proxmox-lang-1+default-dev <!nocheck>,
|
||||
librust-proxmox-schema-1+default-dev <!nocheck>,
|
||||
librust-proxmox-time-1+default-dev <!nocheck>,
|
||||
librust-regex-1+default-dev (>= 1.2-~~) <!nocheck>,
|
||||
librust-serde-1+default-dev <!nocheck>,
|
||||
librust-serde-1+derive-dev <!nocheck>,
|
||||
librust-serde-json-1+default-dev <!nocheck>,
|
||||
librust-unicode-width-0.1+default-dev (>= 0.1.8-~~) <!nocheck>,
|
||||
uuid-dev <!nocheck>
|
||||
Maintainer: Proxmox Support Team <support@proxmox.com>
|
||||
Standards-Version: 4.5.1
|
||||
Vcs-Git: git://git.proxmox.com/git/proxmox.git
|
||||
Vcs-Browser: https://git.proxmox.com/?p=proxmox.git
|
||||
Rules-Requires-Root: no
|
||||
|
||||
Package: librust-proxmox-dev
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends:
|
||||
${misc:Depends},
|
||||
librust-anyhow-1+default-dev,
|
||||
librust-base64-0.13+default-dev,
|
||||
librust-endian-trait-0.6+arrays-dev,
|
||||
librust-endian-trait-0.6+default-dev,
|
||||
librust-lazy-static-1+default-dev (>= 1.4-~~),
|
||||
librust-libc-0.2+default-dev,
|
||||
librust-nix-0.19+default-dev (>= 0.19.1-~~),
|
||||
librust-proxmox-io-1+default-dev,
|
||||
librust-proxmox-lang-1+default-dev,
|
||||
librust-proxmox-schema-1+default-dev,
|
||||
librust-proxmox-time-1+default-dev,
|
||||
librust-regex-1+default-dev (>= 1.2-~~),
|
||||
librust-serde-1+default-dev,
|
||||
librust-serde-1+derive-dev,
|
||||
librust-serde-json-1+default-dev,
|
||||
librust-unicode-width-0.1+default-dev (>= 0.1.8-~~),
|
||||
uuid-dev
|
||||
Suggests:
|
||||
librust-proxmox+proxmox-sortable-macro-dev (= ${binary:Version}),
|
||||
librust-proxmox+tokio-dev (= ${binary:Version})
|
||||
Provides:
|
||||
librust-proxmox+default-dev (= ${binary:Version}),
|
||||
librust-proxmox-0-dev (= ${binary:Version}),
|
||||
librust-proxmox-0+default-dev (= ${binary:Version}),
|
||||
librust-proxmox-0.16-dev (= ${binary:Version}),
|
||||
librust-proxmox-0.16+default-dev (= ${binary:Version}),
|
||||
librust-proxmox-0.16.0-dev (= ${binary:Version}),
|
||||
librust-proxmox-0.16.0+default-dev (= ${binary:Version})
|
||||
Description: Generic Proxmox library - Rust source code
|
||||
This package contains the source for the Rust proxmox crate, packaged by
|
||||
debcargo for use with cargo and dh-cargo.
|
||||
|
||||
Package: librust-proxmox+proxmox-sortable-macro-dev
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends:
|
||||
${misc:Depends},
|
||||
librust-proxmox-dev (= ${binary:Version}),
|
||||
librust-proxmox-sortable-macro-0.1+default-dev (>= 0.1.1-~~)
|
||||
Provides:
|
||||
librust-proxmox+sortable-macro-dev (= ${binary:Version}),
|
||||
librust-proxmox-0+proxmox-sortable-macro-dev (= ${binary:Version}),
|
||||
librust-proxmox-0+sortable-macro-dev (= ${binary:Version}),
|
||||
librust-proxmox-0.16+proxmox-sortable-macro-dev (= ${binary:Version}),
|
||||
librust-proxmox-0.16+sortable-macro-dev (= ${binary:Version}),
|
||||
librust-proxmox-0.16.0+proxmox-sortable-macro-dev (= ${binary:Version}),
|
||||
librust-proxmox-0.16.0+sortable-macro-dev (= ${binary:Version})
|
||||
Description: Generic Proxmox library - feature "proxmox-sortable-macro" and 1 more
|
||||
This metapackage enables feature "proxmox-sortable-macro" for the Rust proxmox
|
||||
crate, by pulling in any additional dependencies needed by that feature.
|
||||
.
|
||||
Additionally, this package also provides the "sortable-macro" feature.
|
||||
|
||||
Package: librust-proxmox+tokio-dev
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends:
|
||||
${misc:Depends},
|
||||
librust-proxmox-dev (= ${binary:Version}),
|
||||
librust-tokio-1+default-dev
|
||||
Provides:
|
||||
librust-proxmox-0+tokio-dev (= ${binary:Version}),
|
||||
librust-proxmox-0.16+tokio-dev (= ${binary:Version}),
|
||||
librust-proxmox-0.16.0+tokio-dev (= ${binary:Version})
|
||||
Description: Generic Proxmox library - feature "tokio"
|
||||
This metapackage enables feature "tokio" for the Rust proxmox crate, by pulling
|
||||
in any additional dependencies needed by that feature.
|
@ -1,16 +0,0 @@
|
||||
Copyright (C) 2019,2020 Proxmox Server Solutions GmbH
|
||||
|
||||
This software is written by Proxmox Server Solutions GmbH <support@proxmox.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
@ -1,10 +0,0 @@
|
||||
overlay = "."
|
||||
crate_src_path = ".."
|
||||
maintainer = "Proxmox Support Team <support@proxmox.com>"
|
||||
|
||||
[source]
|
||||
vcs_git = "git://git.proxmox.com/git/proxmox.git"
|
||||
vcs_browser = "https://git.proxmox.com/?p=proxmox.git"
|
||||
|
||||
[packages.lib]
|
||||
depends = [ "uuid-dev" ]
|
@ -1,14 +0,0 @@
|
||||
//! Proxmox "tools" package containing some generic tools along with the schema, API and CLI
|
||||
//! helpers.
|
||||
|
||||
pub mod tools;
|
||||
|
||||
/// An identity (nop) macro. Used by the `#[sortable]` proc macro.
|
||||
#[cfg(feature = "sortable-macro")]
|
||||
#[macro_export]
|
||||
macro_rules! identity {
|
||||
($($any:tt)*) => ($($any)*)
|
||||
}
|
||||
|
||||
#[cfg(feature = "sortable-macro")]
|
||||
pub use proxmox_sortable_macro::sortable;
|
@ -1,78 +0,0 @@
|
||||
//! Predefined Regular Expressions
|
||||
//!
|
||||
//! This is a collection of useful regular expressions
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use regex::Regex;
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[macro_export]
|
||||
macro_rules! IPV4OCTET { () => (r"(?:25[0-5]|(?:2[0-4]|1[0-9]|[1-9])?[0-9])") }
|
||||
#[rustfmt::skip]
|
||||
#[macro_export]
|
||||
macro_rules! IPV6H16 { () => (r"(?:[0-9a-fA-F]{1,4})") }
|
||||
#[rustfmt::skip]
|
||||
#[macro_export]
|
||||
macro_rules! IPV6LS32 { () => (concat!(r"(?:(?:", IPV4RE!(), "|", IPV6H16!(), ":", IPV6H16!(), "))" )) }
|
||||
|
||||
/// Returns the regular expression string to match IPv4 addresses
|
||||
#[rustfmt::skip]
|
||||
#[macro_export]
|
||||
macro_rules! IPV4RE { () => (concat!(r"(?:(?:", IPV4OCTET!(), r"\.){3}", IPV4OCTET!(), ")")) }
|
||||
|
||||
/// Returns the regular expression string to match IPv6 addresses
|
||||
#[rustfmt::skip]
|
||||
#[macro_export]
|
||||
macro_rules! IPV6RE { () => (concat!(r"(?:",
|
||||
r"(?:(?:", r"(?:", IPV6H16!(), r":){6})", IPV6LS32!(), r")|",
|
||||
r"(?:(?:", r"::(?:", IPV6H16!(), r":){5})", IPV6LS32!(), r")|",
|
||||
r"(?:(?:(?:", IPV6H16!(), r")?::(?:", IPV6H16!(), r":){4})", IPV6LS32!(), r")|",
|
||||
r"(?:(?:(?:(?:", IPV6H16!(), r":){0,1}", IPV6H16!(), r")?::(?:", IPV6H16!(), r":){3})", IPV6LS32!(), r")|",
|
||||
r"(?:(?:(?:(?:", IPV6H16!(), r":){0,2}", IPV6H16!(), r")?::(?:", IPV6H16!(), r":){2})", IPV6LS32!(), r")|",
|
||||
r"(?:(?:(?:(?:", IPV6H16!(), r":){0,3}", IPV6H16!(), r")?::(?:", IPV6H16!(), r":){1})", IPV6LS32!(), r")|",
|
||||
r"(?:(?:(?:(?:", IPV6H16!(), r":){0,4}", IPV6H16!(), r")?::", ")", IPV6LS32!(), r")|",
|
||||
r"(?:(?:(?:(?:", IPV6H16!(), r":){0,5}", IPV6H16!(), r")?::", ")", IPV6H16!(), r")|",
|
||||
r"(?:(?:(?:(?:", IPV6H16!(), r":){0,6}", IPV6H16!(), r")?::", ")))"))
|
||||
}
|
||||
|
||||
/// Returns the regular expression string to match IP addresses (v4 or v6)
|
||||
#[rustfmt::skip]
|
||||
#[macro_export]
|
||||
macro_rules! IPRE { () => (concat!(r"(?:", IPV4RE!(), "|", IPV6RE!(), ")")) }
|
||||
|
||||
/// Regular expression string to match IP addresses where IPv6 addresses require brackets around
|
||||
/// them, while for IPv4 they are forbidden.
|
||||
#[rustfmt::skip]
|
||||
#[macro_export]
|
||||
macro_rules! IPRE_BRACKET { () => (
|
||||
concat!(r"(?:",
|
||||
IPV4RE!(),
|
||||
r"|\[(?:",
|
||||
IPV6RE!(),
|
||||
r")\]",
|
||||
r")"))
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
pub static ref IP_REGEX: Regex = Regex::new(concat!(r"^", IPRE!(), r"$")).unwrap();
|
||||
pub static ref IP_BRACKET_REGEX: Regex =
|
||||
Regex::new(concat!(r"^", IPRE_BRACKET!(), r"$")).unwrap();
|
||||
pub static ref SHA256_HEX_REGEX: Regex = Regex::new(r"^[a-f0-9]{64}$").unwrap();
|
||||
pub static ref SYSTEMD_DATETIME_REGEX: Regex =
|
||||
Regex::new(r"^\d{4}-\d{2}-\d{2}( \d{2}:\d{2}(:\d{2})?)?$").unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_regexes() {
|
||||
assert!(IP_REGEX.is_match("127.0.0.1"));
|
||||
assert!(IP_REGEX.is_match("::1"));
|
||||
assert!(IP_REGEX.is_match("2014:b3a::27"));
|
||||
assert!(IP_REGEX.is_match("2014:b3a::192.168.0.1"));
|
||||
assert!(IP_REGEX.is_match("2014:b3a:0102:adf1:1234:4321:4afA:BCDF"));
|
||||
|
||||
assert!(IP_BRACKET_REGEX.is_match("127.0.0.1"));
|
||||
assert!(IP_BRACKET_REGEX.is_match("[::1]"));
|
||||
assert!(IP_BRACKET_REGEX.is_match("[2014:b3a::27]"));
|
||||
assert!(IP_BRACKET_REGEX.is_match("[2014:b3a::192.168.0.1]"));
|
||||
assert!(IP_BRACKET_REGEX.is_match("[2014:b3a:0102:adf1:1234:4321:4afA:BCDF]"));
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
//! This is a general utility crate used by all our rust projects.
|
||||
|
||||
use std::fmt;
|
||||
|
||||
use anyhow::{bail, Error};
|
||||
|
||||
use proxmox_io::vec;
|
||||
|
||||
pub mod common_regex;
|
||||
|
||||
const HEX_CHARS: &[u8; 16] = b"0123456789abcdef";
|
||||
|
||||
/// Helper to provide a `Display` for arbitrary byte slices.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct AsHex<'a>(pub &'a [u8]);
|
||||
|
||||
impl AsHex<'_> {
|
||||
pub fn display_len(self) -> usize {
|
||||
self.0.len() * 2
|
||||
}
|
||||
|
||||
pub fn to_hex_string(self) -> String {
|
||||
use std::fmt::Write;
|
||||
let mut s = String::with_capacity(self.display_len());
|
||||
write!(&mut s, "{}", self).expect("failed to format hex string");
|
||||
s
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for AsHex<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let mut buf = [0u8, 0u8];
|
||||
for b in self.0 {
|
||||
buf[0] = HEX_CHARS[(*b >> 4) as usize];
|
||||
buf[1] = HEX_CHARS[(*b & 0xf) as usize];
|
||||
f.write_str(unsafe { std::str::from_utf8_unchecked(&buf[..]) })?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn digest_to_hex(digest: &[u8]) -> String {
|
||||
bin_to_hex(digest)
|
||||
}
|
||||
|
||||
/// Convert a byte slice to a string of hexadecimal digits.
|
||||
///
|
||||
/// ```
|
||||
/// # use proxmox::tools::bin_to_hex;
|
||||
///
|
||||
/// let text = bin_to_hex(&[1, 2, 0xff]);
|
||||
/// assert_eq!(text, "0102ff");
|
||||
/// ```
|
||||
pub fn bin_to_hex(digest: &[u8]) -> String {
|
||||
AsHex(digest).to_string()
|
||||
}
|
||||
|
||||
/// Convert an ascii character into a hex nibble.
|
||||
fn hex_nibble_to_byte(b: u8) -> Result<u8, Error> {
|
||||
Ok(match b {
|
||||
b'0'..=b'9' => b - b'0',
|
||||
b'a'..=b'f' => b - b'a' + 0xA,
|
||||
b'A'..=b'F' => b - b'A' + 0xA,
|
||||
_ => bail!("not a hexadecimal digit: {}", char::from(b)),
|
||||
})
|
||||
}
|
||||
|
||||
/// Parse hexadecimal digits into a byte array.
|
||||
pub fn hex_to_bin_exact(hex: &str, out: &mut [u8]) -> Result<(), Error> {
|
||||
let bytes = hex.as_bytes();
|
||||
|
||||
if bytes.len() != out.len() * 2 {
|
||||
bail!(
|
||||
"hexadecimal string has invalid length ({}, expected {})",
|
||||
bytes.len(),
|
||||
out.len() * 2,
|
||||
);
|
||||
}
|
||||
|
||||
for i in 0..out.len() {
|
||||
let h = hex_nibble_to_byte(bytes[i * 2])?;
|
||||
let l = hex_nibble_to_byte(bytes[i * 2 + 1])?;
|
||||
out[i] = (h << 4) | l;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Convert a string of hexadecimal digits to a byte vector. Any non-digits are treated as an
|
||||
/// error, so when there is possible whitespace in the string it must be stripped by the caller
|
||||
/// first. Also, only full bytes are allowed, so the input must consist of an even number of
|
||||
/// digits.
|
||||
///
|
||||
/// ```
|
||||
/// # use proxmox::tools::hex_to_bin;
|
||||
///
|
||||
/// let data = hex_to_bin("aabb0123").unwrap();
|
||||
/// assert_eq!(&data, &[0xaa, 0xbb, 0x01, 0x23]);
|
||||
/// ```
|
||||
pub fn hex_to_bin(hex: &str) -> Result<Vec<u8>, Error> {
|
||||
if (hex.len() % 2) != 0 {
|
||||
bail!("hex_to_bin: got wrong input length.");
|
||||
}
|
||||
|
||||
let mut out = unsafe { vec::uninitialized(hex.len() / 2) };
|
||||
hex_to_bin_exact(hex, &mut out)?;
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
// FIXME: This should be renamed to contain the digest algorithm, so that the array's size makes
|
||||
// sense.
|
||||
pub fn hex_to_digest(hex: &str) -> Result<[u8; 32], Error> {
|
||||
let mut digest = [0u8; 32];
|
||||
hex_to_bin_exact(hex, &mut digest)?;
|
||||
Ok(digest)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hex() {
|
||||
let mut out = [0u8; 5];
|
||||
hex_to_bin_exact("abCA01239f", &mut out).expect("failed to parse hex digit");
|
||||
assert_eq!(out, *b"\xab\xca\x01\x23\x9f");
|
||||
let v = hex_to_bin("abCA01239f").expect("failed to parse hex digit");
|
||||
assert_eq!(v, out);
|
||||
|
||||
hex_to_bin_exact("abca01239", &mut out).expect_err("parsed invalid hex string");
|
||||
hex_to_bin_exact("abca01239fa", &mut out).expect_err("parsed invalid hex string");
|
||||
hex_to_bin_exact("abca0x239f", &mut out).expect_err("parsed invalid hex string");
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user