@@ -152,10 +152,11 @@ impl Builder {
152
152
/// before falling back on constructing a socket address from those
153
153
/// defaults.
154
154
///
155
- /// The socket address can be either a TCP socket address or a
156
- /// [Unix domain socket] (UDS) address. Unix domain sockets are only
157
- /// supported on Unix-compatible operating systems, such as Linux, BSDs,
158
- /// and macOS.
155
+ /// The socket address can be either a TCP socket address, a
156
+ /// [Unix domain socket] (UDS) address, or a [Vsock] address.
157
+ /// Unix domain sockets are only supported on Unix-compatible operating systems,
158
+ /// such as Linux, BSDs, and macOS. Vsock addresses are only available when the
159
+ /// "vsock" feature is enabled and are supported on platforms with vsock capability.
159
160
///
160
161
/// Each call to this method will overwrite the previously set value.
161
162
///
@@ -181,8 +182,17 @@ impl Builder {
181
182
/// let builder = Builder::default().server_addr(Path::new("/tmp/tokio-console"));
182
183
/// ```
183
184
///
185
+ /// Connect using a vsock connection (requires the "vsock" feature):
186
+ ///
187
+ /// ```
188
+ /// # use console_subscriber::Builder;
189
+ /// # #[cfg(feature = "vsock")]
190
+ /// let builder = Builder::default().server_addr((tokio_vsock::VMADDR_CID_ANY, 6669));
191
+ /// ```
192
+ ///
184
193
/// [environment variable]: `Builder::with_default_env`
185
194
/// [Unix domain socket]: https://en.wikipedia.org/wiki/Unix_domain_socket
195
+ /// [Vsock]: https://docs.rs/tokio-vsock/latest/tokio_vsock/
186
196
pub fn server_addr ( self , server_addr : impl Into < ServerAddr > ) -> Self {
187
197
Self {
188
198
server_addr : server_addr. into ( ) ,
@@ -574,6 +584,9 @@ pub enum ServerAddr {
574
584
/// A Unix socket address.
575
585
#[ cfg( unix) ]
576
586
Unix ( PathBuf ) ,
587
+ /// A vsock address.
588
+ #[ cfg( feature = "vsock" ) ]
589
+ Vsock ( tokio_vsock:: VsockAddr ) ,
577
590
}
578
591
579
592
impl From < SocketAddr > for ServerAddr {
@@ -617,6 +630,13 @@ impl<'a> From<&'a Path> for ServerAddr {
617
630
}
618
631
}
619
632
633
+ #[ cfg( feature = "vsock" ) ]
634
+ impl From < tokio_vsock:: VsockAddr > for ServerAddr {
635
+ fn from ( addr : tokio_vsock:: VsockAddr ) -> ServerAddr {
636
+ ServerAddr :: Vsock ( addr)
637
+ }
638
+ }
639
+
620
640
/// Initializes the console [tracing `Subscriber`][sub] and starts the console
621
641
/// subscriber [`Server`] on its own background thread.
622
642
///
0 commit comments