Skip to content

Commit

Permalink
chore: readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hlhr202 committed Apr 18, 2024
1 parent bf91e7c commit f27c575
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 32 deletions.
32 changes: 1 addition & 31 deletions crates/openconnect-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,7 @@ Read the [openconnect-sys](https://crates.io/crates/openconnect-sys) crate docum
openconnect-core = "0.1"
```

- Use the library in your code:

```rust
use openconnect_core::{
config::{ConfigBuilder, EntrypointBuilder, LogLevel},
events::EventHandlers,
protocols::get_anyconnect_protocol,
Connectable, VpnClient,
};
use std::env;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let protocol = get_anyconnect_protocol();
let config = ConfigBuilder::default().loglevel(LogLevel::Info).build()?;
let event_handlers = EventHandlers::default();
let client = VpnClient::new(config, event_handlers)?;

let entrypoint = EntrypointBuilder::new()
.server("vpn.example.com")
.username("your_username")
.password("your_password")
.protocol(protocol)
.enable_udp(true)
.accept_insecure_cert(true)
.build()?;

client.connect(entrypoint)?;

Ok(())
}
```
- For simple use cases, please refer to [openconnect-core docs](https://docs.rs/openconnect-core/).

- For more use cases, you can checkout our CLI application [openconnect-cli](https://github.com/hlhr202/Openconnect-RS/tree/main/crates/openconnect-cli).

Expand Down
8 changes: 8 additions & 0 deletions crates/openconnect-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#![doc = include_str!("../README.md")]

//! ## Example: Password Server
//!
//! This example demonstrates how to connect to a VPN server using username + password authentication
//!
//! ```rust
#![doc = include_str!("../examples/password_server.rs")]
//! ```
mod cert;
pub mod command;
pub mod config;
Expand Down
2 changes: 1 addition & 1 deletion crates/openconnect-gui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "openconnect-gui",
"private": true,
"version": "0.0.0",
"version": "0.1.5",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down

0 comments on commit f27c575

Please sign in to comment.