i2phttpproxy

package module
v0.0.0-...-1fa7301 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2019 License: MIT Imports: 28 Imported by: 0

README

i2phttpproxy

This is way more useful than it is tested. Please be careful.

On Unixes, always run it with the flag -littleboss=start to ensure that the proxy always re-starts itself.

This is a very simple standalone HTTP Proxy for I2P based on the SAM Bridge. It has a few advantages in certain situations, especially for adapting applications that speak HTTP to the I2P network. It allows applications to start their own HTTP proxies, with their own identities within I2P and their own discrete configurations. It also has some disadvantages, it cannot add new readable names to your I2P address book nor is it able to use an outproxy. It's new, but it should be stable enough to experiment with a Tor Browser or a hardened Firefox configuration.

It is not, and is not intended to be, and will not be intended for use by multiple clients at the same time. It might be more-or-less OK as part of an inproxy but you should only use it for one client at a time. A multi-client solution will also be available soon(eeProxy).

This is not something you should use without understanding. It is also not terribly hard to understand. It runs two services. One is an HTTP proxy that uses the SAM API to retrieve information from I2P. The other is a controller for that http proxy which, for now, only has one function that re-starts it entirely. Doing this closes your SAM connection and your existing tunnels, guaranteeing that you browse new sites with a fresh identity. The reset function on UNIX-Like operating systems can optionally re-set an application's configuration back to the state it was in when the proxy was started.

This is useful because I2P tunnel identities can be tracked across eepSites during contemporary visits, and when combined with a long-term identifier like a user account, can become "Retroactively Linkable." This enables an easy-to-use, user-controlled interface for manually creating a new identity before and after logging into an eepSite with a user account. An example application which uses this is i2psetproxy.js a WebExtension which assures I2P Proxy settings and provides a "Reset Identity" button on the Firefox toolbar.

Features: Done

  • Self-supervising, Self-restarting on Unixes
  • CONNECT support
  • "New Ident" signaling interface(Unix-only for now)(I guess I might have done for Windows too now but I haven't tried it out yet).
  • Outproxy Support

Features: Planned

  • Traffic Shaping

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Quiet bool

Functions

func SetAddr

func SetAddr(s ...string) func(*SAMHTTPProxy) error

SetAddr sets a clients's address in the form host:port or host, port

func SetAddrMixed

func SetAddrMixed(s string, i int) func(*SAMHTTPProxy) error

SetAddrMixed sets a clients's address in the form host, port(int)

func SetCloseIdle

func SetCloseIdle(b bool) func(*SAMHTTPProxy) error

SetCloseIdle enables debugging messages

func SetCloseIdleTime

func SetCloseIdleTime(u uint) func(*SAMHTTPProxy) error

SetCloseIdleTime sets time to wait before the tunnel quantity is reduced

func SetCompression

func SetCompression(b bool) func(*SAMHTTPProxy) error

SetCompression sets the tunnels to close after a specific amount of time

func SetControlAddr

func SetControlAddr(s ...string) func(*SAMHTTPProxy) error

SetControlAddr sets a clients's address in the form host:port or host, port

func SetControlHost

func SetControlHost(s string) func(*SAMHTTPProxy) error

SetContrlHost sets the host of the client's Proxy controller

func SetControlPort

func SetControlPort(s string) func(*SAMHTTPProxy) error

SetContrlPort sets the host of the client's Proxy controller

func SetDebug

func SetDebug(b bool) func(*SAMHTTPProxy) error

SetDebug enables debugging messages

func SetEncrypt

func SetEncrypt(b bool) func(*SAMHTTPProxy) error

SetEncrypt tells the router to use an encrypted leaseset

func SetHost

func SetHost(s string) func(*SAMHTTPProxy) error

SetHost sets the host of the client's SAM bridge

func SetInBackups

func SetInBackups(u uint) func(*SAMHTTPProxy) error

SetInBackups sets the inbound tunnel backups

func SetInLength

func SetInLength(u uint) func(*SAMHTTPProxy) error

SetInLength sets the number of hops inbound

func SetInQuantity

func SetInQuantity(u uint) func(*SAMHTTPProxy) error

SetInQuantity sets the inbound tunnel quantity

func SetInVariance

func SetInVariance(i int) func(*SAMHTTPProxy) error

SetInVariance sets the variance of a number of hops inbound

func SetKeysPath

func SetKeysPath(s string) func(*SAMHTTPProxy) error

SetKeysPath sets the path to the key save files

func SetName

func SetName(s string) func(*SAMHTTPProxy) error

SetName sets a clients's address in the form host:port or host, port

func SetOutBackups

func SetOutBackups(u uint) func(*SAMHTTPProxy) error

SetOutBackups sets the inbound tunnel backups

func SetOutLength

func SetOutLength(u uint) func(*SAMHTTPProxy) error

SetOutLength sets the number of hops outbound

func SetOutProxy

func SetOutProxy(s string) func(*SAMHTTPProxy) error

SetOutProxy sets the host of the client's outproxy, it may be a base32 or a local proxy

func SetOutProxySocks

func SetOutProxySocks(s bool) func(*SAMHTTPProxy) error

SetOutProxySocks tells it to use a SOCKS outproxy instead of HTTP

func SetOutQuantity

func SetOutQuantity(u uint) func(*SAMHTTPProxy) error

SetOutQuantity sets the outbound tunnel quantity

func SetOutVariance

func SetOutVariance(i int) func(*SAMHTTPProxy) error

SetOutVariance sets the variance of a number of hops outbound

func SetPort

func SetPort(s string) func(*SAMHTTPProxy) error

SetPort sets the port of the client's SAM bridge using a string

func SetPortInt

func SetPortInt(i int) func(*SAMHTTPProxy) error

SetPortInt sets the port of the client's SAM bridge using a string

func SetProxyAddr

func SetProxyAddr(s ...string) func(*SAMHTTPProxy) error

SetProxyAddr sets a clients's address in the form host:port or host, port

func SetProxyHost

func SetProxyHost(s string) func(*SAMHTTPProxy) error

SetProxyHost sets the host of the client's Proxy controller

func SetProxyPort

func SetProxyPort(s string) func(*SAMHTTPProxy) error

SetProxyPort sets the host of the client's Proxy controller

func SetReduceIdle

func SetReduceIdle(b bool) func(*SAMHTTPProxy) error

SetReduceIdle sets the created tunnels to be reduced during extended idle time to avoid excessive resource usage

func SetReduceIdleQuantity

func SetReduceIdleQuantity(u uint) func(*SAMHTTPProxy) error

SetReduceIdleQuantity sets number of tunnels to keep alive during an extended idle period

func SetReduceIdleTime

func SetReduceIdleTime(u uint) func(*SAMHTTPProxy) error

SetReduceIdleTime sets time to wait before the tunnel quantity is reduced

func SetUnpublished

func SetUnpublished(b bool) func(*SAMHTTPProxy) error

SetUnpublished tells the router to not publish the client leaseset

func SetupProxy

func SetupProxy(addr string)

SetupProxy sets proxy environment variables based on a string address

func UnProxyLocal

func UnProxyLocal(additionalAddresses []string)

UnProxyLocal adds local IP addresses to an un-proxied range. It is not used here but is useful for some servers.

Types

type Option

type Option func(*SAMHTTPProxy) error

Option is a client Option

type SAMHTTPController

type SAMHTTPController struct {
	ProxyServer *http.Server
	Profiles    []string
	// contains filtered or unexported fields
}

func NewSAMHTTPController

func NewSAMHTTPController(profiles []string, proxy *http.Server) (*SAMHTTPController, error)

func (*SAMHTTPController) ServeHTTP

func (p *SAMHTTPController) ServeHTTP(wr http.ResponseWriter, req *http.Request)

type SAMHTTPProxy

type SAMHTTPProxy struct {
	Hasher *hashhash.Hasher

	UseOutProxy string

	Conf *i2ptunconf.Conf
	// contains filtered or unexported fields
}

func NewHttpProxy

func NewHttpProxy(opts ...func(*SAMHTTPProxy) error) (*SAMHTTPProxy, error)

func (*SAMHTTPProxy) Base32

func (p *SAMHTTPProxy) Base32() string

func (*SAMHTTPProxy) Base32Readable

func (f *SAMHTTPProxy) Base32Readable() string

Base32Readable returns the base32 address where the local service is being forwarded, but as a list of English words(More languages later if it works) instead of as a hash for person-to-person transmission.

func (*SAMHTTPProxy) Base64

func (p *SAMHTTPProxy) Base64() string

func (*SAMHTTPProxy) Cleanup

func (p *SAMHTTPProxy) Cleanup()

func (*SAMHTTPProxy) Close

func (p *SAMHTTPProxy) Close() error

func (*SAMHTTPProxy) Config

func (f *SAMHTTPProxy) Config() *i2ptunconf.Conf

func (*SAMHTTPProxy) GetType

func (f *SAMHTTPProxy) GetType() string

func (*SAMHTTPProxy) GuaranteePrefix

func (p *SAMHTTPProxy) GuaranteePrefix(str string) string

func (*SAMHTTPProxy) ID

func (f *SAMHTTPProxy) ID() string

func (*SAMHTTPProxy) Keys

func (f *SAMHTTPProxy) Keys() i2pkeys.I2PKeys

func (*SAMHTTPProxy) Load

func (handler *SAMHTTPProxy) Load() (samtunnel.SAMTunnel, error)

func (*SAMHTTPProxy) Print

func (p *SAMHTTPProxy) Print() string

func (*SAMHTTPProxy) Props

func (f *SAMHTTPProxy) Props() map[string]string

func (*SAMHTTPProxy) Save

func (p *SAMHTTPProxy) Save() string

func (*SAMHTTPProxy) Search

func (p *SAMHTTPProxy) Search(search string) string

func (*SAMHTTPProxy) Serve

func (p *SAMHTTPProxy) Serve() error

func (*SAMHTTPProxy) ServeHTTP

func (p *SAMHTTPProxy) ServeHTTP(wr http.ResponseWriter, req *http.Request)

func (*SAMHTTPProxy) SetupProxy

func (p *SAMHTTPProxy) SetupProxy()

SetupProxy sets proxy environment variables based on the settings in use by the proxy

func (*SAMHTTPProxy) Target

func (p *SAMHTTPProxy) Target() string

func (*SAMHTTPProxy) Up

func (f *SAMHTTPProxy) Up() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL