MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / read_vsock_port

Function read_vsock_port

tdx-attest/src/linux.rs:535–558  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

533}
534
535fn read_vsock_port() -> Result<u32> {
536 let content = match fs::read_to_string(TDX_ATTEST_CONFIG_PATH) {
537 Ok(c) => c,
538 Err(_) => return Ok(0),
539 };
540
541 for line in content.lines() {
542 let line = line.trim();
543 if line.starts_with('#') {
544 continue;
545 }
546 if let Some(rest) = line.strip_prefix("port") {
547 let rest = rest.trim_start();
548 if let Some(rest) = rest.strip_prefix('=') {
549 let port_str = rest.trim();
550 if let Ok(port) = port_str.parse::<u32>() {
551 return Ok(port);
552 }
553 }
554 }
555 }
556
557 Ok(0)
558}
559
560/// Build QGS get_quote request message
561///

Callers 2

is_vsock_availableFunction · 0.85
get_quote_via_vsockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected