domain_changer

Wagmi

Rust report

Rust library that helps you to change the domain of the link to another domain, the library helps with privacy. It can be used to change the domain of sites that do not care about privacy to another that does.

Examples

Parse String

Parse the string and convert the old urls to new one

Note: You can change the domains as you want ```rust use domainchanger::parsestring; use domain_changer::types::Config;

let text: String = "Wellcome to my youtube channel: https://www.youtube.com/channel/UCeRbJsc8cl7xBwT3jIxaAdg And my twitter is: twitter.com/Awiteb".tostring(); let config: Config = Config::default(); asserteq!(parsestring(&config, text), "Wellcome to my youtube channel: https://piped.kavin.rocks/channel/UCeRbJsc8cl7xBwT3jIxaAdg And my twitter is: https://nitter.net/Awiteb".tostring() ); ```

Extract Domains

You can extract domains from string if any (Just the domain you add it to config) ```rust use domainchanger::extractolddomains; use domainchanger::types::{Config, Domain};

let config: Config = Config::default(); let text: String = String::from( "Hi i hate youtube.com and https://twitter.com what about you?" ); asserteq!( extractolddomains(&config, text), vec![ &Domain::tryfrom(("https://youtube.com/", "https://piped.kavin.rocks/")).unwrap(), &Domain::try_from(("https://twitter.com/", "https://nitter.net/")).unwrap() ] ); ```

Serialize and Deserialize (json feature)

Serialize and deserialize from/to json in Domain struct and Config

Note: Need json feature

Domain

```rust use domain_changer::types::{Domain, ToFromJson};

let domain: Domain = Domain::tryfrom(("https://twitter.com/", "https://nitter.net/")).unwrap(); asserteq!(domain.tojson().unwrap(), "{\"old\":\"https://twitter.com/\",\"new\":\"https://nitter.net/\"}"); asserteq!(Domain::fromjson("{\"old\":\"https://twitter.com/\",\"new\":\"https://nitter.net/\"}").unwrap(), domain); assert!(Domain::fromjson("{\"old\":\"twitter.com/\",\"new\":\"nitter.net/\"}").is_err()); ```

Config

```rust use domain_changer::types::{Config, Domain, ToFromJson};

let config: Config = Config::new(vec![Domain::tryfrom(("https://twitter.com/", "https://nitter.net/")).unwrap()]); asserteq!( config.tojson().unwrap(), "{\"domains\":[{\"old\":\"https://twitter.com/\",\"new\":\"https://nitter.net/\"}]}".tostring() );

asserteq!( Config::fromjson("{\"domains\":[{\"old\":\"https://twitter.com/\",\"new\":\"https://nitter.net/\"}]}").unwrap(), config ); ```

Donating

| Currency | Address | |-------------------------|--------------------------------------------------| | Binance BNB BEP20 | 0xD89c146B03B72191be91064D313610981dCAF6d4 | | USD Coin USDC BEP20 | 0xD89c146B03B72191be91064D313610981dCAF6d4 | | Bitcoin BTC | bc1q0ltmqmsc4qs740ssyf9k9jq99nwxtqu8aupmdj | | Bitcoin Cash BCH | qrpm6zyte3d4z2u9r24l04m3havc2wd9vgqlz8sjgr |

Contributors

License

The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.