Renamed and readme docs

This commit is contained in:
Jan-Erik Rediger
2023-03-12 19:36:42 +01:00
parent ad8d029ae8
commit dea21fa9aa
6 changed files with 49 additions and 31 deletions
Generated
+12 -12
View File
@@ -216,18 +216,6 @@ version = "0.2.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
[[package]]
name = "libtailscale"
version = "0.1.0"
dependencies = [
"env_logger",
"hyper",
"log",
"nix",
"thiserror",
"tokio",
]
[[package]]
name = "linux-raw-sys"
version = "0.1.4"
@@ -453,6 +441,18 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
[[package]]
name = "tsnet"
version = "0.1.0"
dependencies = [
"env_logger",
"hyper",
"log",
"nix",
"thiserror",
"tokio",
]
[[package]]
name = "unicode-ident"
version = "1.0.8"
+1 -1
View File
@@ -1,5 +1,5 @@
[package]
name = "libtailscale"
name = "tsnet"
version = "0.1.0"
edition = "2021"
license = "BSD-3-Clause"
+29 -11
View File
@@ -1,32 +1,50 @@
# libtailscale
# tsnet - bindings for libtailscale.
libtailscale is a C library that embeds Tailscale into a process.
tsnet is a Rust crate wrapping libtailscale and exposing a Rust-y API on top.
Use this library to compile Tailscale into your program and get
an IP address on a tailnet, entirely from userspace.
## Building
## Requirements
With the latest version of Go, run:
* Rust compiler & Cargo
* Go v1.20 or higher
```
go build -buildmode=c-archive
## Getting started
After running `cargo init` add the following lines to your `Cargo.toml` file:
```toml
tsnet = "0.1.0"
```
This will produce a `libtailscale.a` file. Link it into your binary,
and use the `tailscale.h` header to reference it.
## Development
It is also possible to build a shared library using
Build with
```
go build -buildmode=c-shared
cargo build
```
Run tests with
```
cargo test
```
Run the examples with
```
cargo run --example echo_server
cargo run --example echo_client
```
## Bugs
Please file any issues about this code or the hosted service on
[the issue tracker](https://github.com/tailscale/tailscale/issues).
[the issue tracker](https://github.com/badboy/tailscale/issues).
## License
BSD 3-Clause for this repository, see LICENSE.
BSD 3-Clause for this repository, see LICENSE.
+1 -1
View File
@@ -1,6 +1,6 @@
use std::{env, io::Write};
use libtailscale::{ServerBuilder, Network};
use tsnet::{ServerBuilder, Network};
fn main() {
let target = env::args()
+1 -1
View File
@@ -4,7 +4,7 @@ use std::{
thread,
};
use libtailscale::{ServerBuilder, Network};
use tsnet::{ServerBuilder, Network};
fn main() {
env_logger::init();
+5 -5
View File
@@ -13,7 +13,7 @@
//!
//! ```rust,no_run
//! use std::net::TcpStream;
//! use libtailscale::{ServerBuilder, Network};
//! use tsnet::{ServerBuilder, Network};
//!
//! fn main() {
//! let ts = ServerBuilder::new().ephemeral().redirect_log().build().unwrap();
@@ -37,7 +37,7 @@
//! ```rust,no_run
//! use std::{env, io::Write};
//!
//! use libtailscale::{ServerBuilder, Network};
//! use tsnet::{ServerBuilder, Network};
//!
//! fn main() {
//! let srv = ServerBuilder::new()
@@ -124,7 +124,7 @@ impl Display for Network {
/// ## Example
///
/// ```rust,no_run
/// use libtailscale::{ServerBuilder, Network};
/// use tsnet::{ServerBuilder, Network};
///
/// let server = ServerBuilder::new().ephemeral().build().unwrap();
/// let ln = server.listen(Network::Tcp, ":1999").unwrap();
@@ -222,7 +222,7 @@ impl Drop for Server {
/// ## Example
///
/// ```rust,no_run
/// use libtailscale::ServerBuilder;
/// use tsnet::ServerBuilder;
///
/// let server = ServerBuilder::new().ephemeral().build().unwrap();
/// ```
@@ -401,7 +401,7 @@ impl ServerBuilder {
///
/// ```rust,no_run
/// use std::net::TcpStream;
/// use libtailscale::{ServerBuilder, Network, Result};
/// use tsnet::{ServerBuilder, Network, Result};
///
/// fn handle_client(stream: TcpStream) {
/// // ...