Update README.md

master
xethyrion 2017-02-21 21:04:06 +02:00 committed by GitHub
parent 43a19d7c61
commit 10302dd4b1
1 changed files with 3 additions and 3 deletions

View File

@ -6,8 +6,8 @@ multiaddr for IPFS in C.
#### All you need to include is multiaddr.h
## Maddr struct:
* char * string; // String that contains addresses such as /ip4/192.168.1.1/
* uint8_t bytes; //String that contains the enecoded address
* size_t bsize; //int[1] that contains the real bytes size (Use it whenever using the bytes so you don't input trash!)
* uint8_t * bytes; // uint8_t * that contains the enecoded address
* size_t bsize; //size_t that contains the real bytes size (Use it whenever using the bytes so you don't input trash!)
## New Multi Address From String(multiaddress_new_from_string)
struct MultiAddress* a = multiaddress_new_from_string("/ip4/127.0.0.1/tcp/8080/");
@ -18,7 +18,7 @@ struct MultiAddress* a = multiaddress_new_from_string("/ip4/127.0.0.1/tcp/8080/"
## Encapsulation & Decapsulation(m_encapsulate, m_decapsulate)
#### Remember, Decapsulation happens from right to left, never in reverse, if you have /ip4/udp/ipfs/ if you decapsulate "udp" you will also take out ipfs!
* Now the string is: /ip4/192.168.1.1/
* multiaddress_encapsulate(a,"/udp/3333/"); //Adds udp/3333/ to char addrstr
* multiaddress_encapsulate(a,"/udp/3333/"); //Adds udp/3333/
* Now the string is: /ip4/192.168.1.1/udp/3333/
* multiaddress_decapsulate(a,"udp"); //Removes udp protocol and its address
* Now the string is: /ip4/192.168.1.1/