/

So You Want To Write A SAM Library

Or, talking to i2p for people who aren’t really used to reading specs

One of the best features of I2P, in my opinion, is it’s SAM API, which can be used to build a bridge between I2P and your application or language of choice. Currently, dozens of SAM libraries exist for a variety of languages, including:

If you’re using any of these languages, you may be able to port your application to I2P already, using an existing library. That’s not what this tutorial is about, though. This tutorial is about what to do if you want to create a SAM library in a new language. In this tutorial, I will implement a new SAM library in Java. I chose Java because there isn’t a Java library that connects you to SAM yet, because of Java’s use in Android, and because it’s a language almost everybody has at least a little experience with, so hopefully you can translate it into a language of your choice.

Creating your library

How you set up your own library will vary depending on the language you wish to use. For this example library, we’ll be using java so we can create a library like this:

mkdir jsam
cd jsam
gradle init --type java-library

Or, if you are using gradle 5 or greater:

gradle init --type java-library --project-name jsam
Get the source code:
Show license
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to 
Hide license
I2P