[package]
name = "qcp"
version = "0.8.0"
authors = ["Ross Younger <qcp@crazyscot.com>"]
categories = ["command-line-utilities"]
edition.workspace = true
homepage = "https://github.com/crazyscot/qcp/"
keywords = ["networking", "file-transfer", "quic"]
license = "AGPL-3.0-or-later"
readme = "../README.md"
repository = "https://github.com/crazyscot/qcp/"
rust-version = "1.88.0"
description = "Secure remote file copy utility which uses the QUIC protocol over UDP"

[[bin]]
name = "qcp"

[lib]

[features]
default = ["rustls-log", "quinn-log", "secure-alloc"]
## Enables rustls debug messages. You still have to request them using the environment variable, e.g. `RUST_LOG="rustls=debug"`.
rustls-log = ["quinn/rustls-log"]
## Enables quinn debug messages. You still have to request them using the environment variable, e.g. `RUST_LOG="quinn=debug"`.
quinn-log = ["quinn/log"]
## Selects secure mode for memory allocations.
## This protects against various heap vulnerabilities, though comes at a performance cost.
## Extremely high bandwidth environments may wish to experiment with this for performance.
secure-alloc = ["mimalloc/secure"]
## Builds test helpers. This is intended only for use by qcp-unsafe-tests.
unstable-test-helpers = []

[dependencies]
anstyle = { workspace = true }
anyhow = { workspace = true }
async-trait = { workspace = true }
bytes = { workspace = true }
cfg-if = { workspace = true }
clap = { workspace = true }
colorchoice = { workspace = true }
console = { workspace = true }
derive-deftly = { workspace = true }
derive_more = { workspace = true, features = ["constructor", "debug", "display", "from"] }
dirs = { workspace = true }
document-features = { workspace = true }
dtype_variant = { workspace = true }
either = { workspace = true }
engineering-repr = { workspace = true, features = ["serde"] }
enumscribe = { workspace = true }
figment = { workspace = true, features = ["env"] }
futures-util = { workspace = true }
gethostname = { workspace = true }
glob.workspace = true
heck = { workspace = true }
hex = { workspace = true }
homedir = { workspace = true }
human-repr = { workspace = true }
indicatif = { workspace = true, features = ["tokio"] }
int-enum = { workspace = true }
lessify = { workspace = true }
mimalloc = { workspace = true }
num-format = { workspace = true }
num-traits = { workspace = true }
paste = { workspace = true }
quinn = { workspace = true, features = ["runtime-tokio", "rustls", "ring"] }
rcgen = { workspace = true }
rustix = { workspace = true, features = ["net", "fs", "process"] }
rustls = { workspace = true, features = ["ring"] }
rustls-pki-types = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_bare = { workspace = true }
serde_repr = { workspace = true }
static_assertions = { workspace = true }
struct-field-names-as-array = { workspace = true }
strum = { workspace = true, features = ["derive"] }
strum_macros = { workspace = true }
tabled = { workspace = true }
termsize = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter", "chrono"] }
walkdir = { workspace = true }
wildmatch = { workspace = true }

[target.'cfg(unix)'.dependencies]
file-mode = { workspace = true }

[dev-dependencies]
assertables = { workspace = true }
clap-markdown = { workspace = true }
clap_mangen = { workspace = true }
jzon = { workspace = true }
littertray = { workspace = true, features = ["async"] }
mockall = { workspace = true }
pretty_assertions = { workspace = true }
roff = { workspace = true }
rstest = { workspace = true }
rusty-fork = { workspace = true }
serde_json = { workspace = true }
tempfile = { workspace = true }
tokio-test = { workspace = true }
x509-certificate = { workspace = true }

[lints.rust]
dead_code = "warn"
elided_lifetimes_in_paths = "deny"
meta_variable_misuse = "deny"
missing_abi = "deny"
missing_copy_implementations = "deny"
missing_debug_implementations = "deny"
missing_docs = "warn"
non_ascii_idents = "deny"
single_use_lifetimes = "deny"
trivial_casts = "deny"
trivial_numeric_casts = "deny"
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(coverage_nightly)'] }
unsafe_code = "forbid"
unsafe_op_in_unsafe_fn = "deny"
unreachable_pub = "deny"
# unused_crate_dependencies = "deny" # false positives
unused_extern_crates = "deny"
unused_lifetimes = "deny"
unused_results = "deny"
variant_size_differences = "deny"

[lints.clippy]
pedantic = { level = "deny", priority = -1 }
missing_errors_doc = "allow"

[lints.rustdoc]
bare_urls = "deny"
broken_intra_doc_links = "deny"
invalid_codeblock_attributes = "deny"
invalid_html_tags = "deny"
invalid_rust_codeblocks = "deny"
missing_crate_level_docs = "deny"
private_intra_doc_links = "deny"
unescaped_backticks = "deny"

[build-dependencies]
cfg_aliases = { workspace = true }

[package.metadata.cross.target.x86_64-unknown-linux-musl]
# pre-build = [ "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install ..." ]
[package.metadata.cross.target.aarch64-unknown-linux-musl]
# pre-build = [ "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install ..." ]

[package.metadata.deb]
extended-description = """\
The QUIC Copier (`qcp`) is an experimental high-performance remote file
copy utility for long-distance internet connections.

It is intended as a drop-in replacement for scp, offering similar
security properties but better throughput on congested networks.
"""
section = "contrib/net"
assets = [
  # sneaky; this seems to automagically pick up the correct binary when cross building:
  [
    "target/release/qcp",
    "usr/bin/",
    "755",
  ],

  [
    "../README.md",
    "usr/share/doc/qcp/",
    "644",
  ],
  [
    "../LICENSE",
    "usr/share/doc/qcp/",
    "644",
  ],
  # gzip -9n < CHANGELOG.md > misc/generated/changelog.gz # done by make-debian-package
  [
    "misc/generated/changelog.gz",
    "usr/share/doc/qcp/",
    "644",
  ],
  # gzip -9n < debian/changelog > debian/changelog.Debian.gz # done by make-debian-package
  [
    "debian/changelog.Debian.gz",
    "usr/share/doc/qcp/",
    "644",
  ],
  [
    "misc/20-qcp.conf",
    "etc/sysctl.d/",
    "644",
  ], # this is automatically recognised as a conffile
  [
    "misc/generated/qcp.1",
    "usr/share/man/man1/",
    "644",
  ],
  [
    "misc/generated/qcp_config.5",
    "usr/share/man/man5/",
    "644",
  ],
  [
    "misc/qcp.conf",
    "etc/",
    "644",
  ], # this is automatically recognised as a conffile
  [
    "misc/qcp_sshd.conf",
    "etc/ssh/sshd_config.d/",
    "644",
  ], # this is automatically recognised as a conffile
  # gzip -9n < qcp/qcp.cdx.xml > qcp/qcp.cdx.xml.gz # done by make-debian-package
  [
    "qcp.cdx.xml.gz",
    "usr/share/doc/qcp/",
    "644",
  ],
  [
    "misc/generated/qcp.html",
    "usr/share/doc/qcp/",
    "644",
  ],
]
maintainer-scripts = "debian"
depends = "$auto,debconf"

[package.metadata.cargo-machete]
ignored = ["cfg_aliases"] # used by build.rs

[package.metadata.cargo-shear]
ignored-paths = [
  "src/doc/performance.rs",
  "src/doc/troubleshooting.rs",
  "src/os/osx.rs",
]
