# tcp-info-sys

[![github-repo](https://img.shields.io/badge/github-BobAnkh/tcp--info--sys-f5dc23?logo=github)](https://github.com/BobAnkh/tcp-info-sys)
[![crates.io](https://img.shields.io/crates/v/tcp-info-sys.svg?logo=rust)](https://crates.io/crates/tcp-info-sys)
[![docs.rs](https://img.shields.io/badge/docs.rs-tcp--info--sys-blue?logo=data:image/svg+xml;base64, )](https://docs.rs/tcp-info-sys)
[![LICENSE Apache-2.0](https://img.shields.io/github/license/BobAnkh/tcp-info-sys?logo=Apache)](https://github.com/BobAnkh/tcp-info-sys/blob/main/LICENSE)

A library to get TCP_INFO from the kernel for a TCP socket.
Provide the binding of TCP_INFO struct and a safe interface to get it from kernel with socket file descriptor.

## Examples

More detailed explanation can be found in [documentation](https://docs.rs/tcp-info-sys).

```rust
use std::io::prelude::*;
use std::net::TcpStream;
use std::os::fd::AsRawFd;
use tcp_info_sys::get_tcp_info;

fn main() -> std::io::Result<()> {
    let stream = TcpStream::connect("127.0.0.1:12345")?;
    let tcp_info = get_tcp_info(stream.as_raw_fd())?;
    println!("TCP Info: {:?}", tcp_info);
    Ok(())
}
```

## Maintainer

[@BobAnkh](https://github.com/BobAnkh)

## How to contribute

You should follow our [Code of Conduct](/CODE_OF_CONDUCT.md).

See [CONTRIBUTING GUIDELINES](/CONTRIBUTING.md) for contributing conventions.

Make sure to pass all the tests before submitting your code.

### Contributors

## LICENSE

[Apache-2.0](LICENSE) © BobAnkh
