gitsam

package module
v0.0.994 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2019 License: MIT Imports: 17 Imported by: 0

README

gitsam

Easy git-over-i2p repositories using SAM. Run it in the root of an existing git repository or in a directory containing many git repositories and automatically create a mirror on I2P.

This is still pretty much a toy. I made it as a goof after I got tired this Saturday. I do intend to refine it as I get more chances to do so but for now it's just for fun.

The versions don't mean anything. I have to increment when I update go mod and I broke it at first.

This simple application combines an I2P Tunnel created by sam-forwarder and a git repository created by gitkit in order to simply host a group of Git repositories over the I2P network. It creates two tunnels to serve groups of repositories, them is read-only and served with plain HTTP-over-I2P, and one of them is read-write and served with SSH-over-I2P. Optionally, the root folder may also be a git repository.

Optionally, if one is not already present, it will set up a post-recieve hook so that the read-only HTTP mirror can double as a web page. Since it uses eephttpd, in the absence of an index.html file an HTML version of the README.md file will be shown, and it can be scripted with tengo(A pure-go fast scripting language).

Eventually, it will have extensive options for optimizing your git configuration.

    Usage of ./gitsam/gitsam:
      -a string
            hostname to serve on (default "127.0.0.1")
      -c	Use an encrypted leaseset(true or false)
      -d string
            the directory of static files to host(default ./www) (default "./")
      -f string
            Use an ini file for configuration (default "none")
      -g	Uze gzip(true or false) (default true)
      -i	save i2p keys(and thus destinations) across reboots (default true)
      -ib int
            Set inbound tunnel backup quantity(0 to 5) (default 1)
      -il int
            Set inbound tunnel length(0 to 7) (default 3)
      -iq int
            Set inbound tunnel quantity(0 to 15) (default 2)
      -iv int
            Set inbound tunnel length variance(-7 to 7)
      -l string
            Type of access list to use, can be "whitelist" "blacklist" or "none". (default "none")
      -lp
            launch a "Page" on read-only HTTP branch (default true)
      -n string
            name to give the tunnel(default gitsam) (default "gitsam")
      -ob int
            Set outbound tunnel backup quantity(0 to 5) (default 1)
      -ol int
            Set outbound tunnel length(0 to 7) (default 3)
      -oq int
            Set outbound tunnel quantity(0 to 15) (default 2)
      -ov int
            Set outbound tunnel length variance(-7 to 7)
      -p string
            port to serve locally on (default "7882")
      -pk string
            Path to the authorized users SSH public key (default "./id_rsa.pub")
      -pp string
            port to serve read-only pages on (default "7883")
      -r	Reduce tunnel quantity when idle(true or false)
      -rc int
            Reduce idle tunnel quantity to X (0 to 5) (default 3)
      -rt int
            Reduce tunnel quantity after X (milliseconds) (default 600000)
      -sh string
            sam host to connect to (default "127.0.0.1")
      -sk string
            Path to the directory with the private keys used to authenticate the server
      -sp string
            sam port to connect to (default "7656")
      -z	Allow zero-hop, non-anonymous tunnels(true or false)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileExists added in v0.0.2

func FileExists(filename string) bool

func SetAccessList

func SetAccessList(s []string) func(*GitSAMTunnel) error

SetAccessList tells the system to treat the accessList as a whitelist

func SetAccessListType

func SetAccessListType(s string) func(*GitSAMTunnel) error

SetAccessListType tells the system to treat the accessList as a whitelist

func SetAllowZeroIn

func SetAllowZeroIn(b bool) func(*GitSAMTunnel) error

SetAllowZeroIn tells the tunnel to accept zero-hop peers

func SetAllowZeroOut

func SetAllowZeroOut(b bool) func(*GitSAMTunnel) error

SetAllowZeroOut tells the tunnel to accept zero-hop peers

func SetCloseIdle

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

SetCloseIdle tells the connection to close it's tunnels during extended idle time.

func SetCloseIdleTime

func SetCloseIdleTime(u int) func(*GitSAMTunnel) error

SetCloseIdleTime sets the time to wait before closing tunnels to idle levels

func SetCloseIdleTimeMs

func SetCloseIdleTimeMs(u int) func(*GitSAMTunnel) error

SetCloseIdleTimeMs sets the time to wait before closing tunnels to idle levels in milliseconds

func SetCompress

func SetCompress(b bool) func(*GitSAMTunnel) error

SetCompress tells clients to use compression

func SetEncrypt

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

SetEncrypt tells the router to use an encrypted leaseset

func SetFastRecieve

func SetFastRecieve(b bool) func(*GitSAMTunnel) error

SetFastRecieve tells clients to use compression

func SetFilePath

func SetFilePath(s string) func(*GitSAMTunnel) error

SetFilePath sets the path to save the config file at.

func SetHost

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

SetHost sets the host of the service to forward

func SetInBackups

func SetInBackups(u int) func(*GitSAMTunnel) error

SetInBackups sets the inbound tunnel backups

func SetInLength

func SetInLength(u int) func(*GitSAMTunnel) error

SetInLength sets the number of hops inbound

func SetInQuantity

func SetInQuantity(u int) func(*GitSAMTunnel) error

SetInQuantity sets the inbound tunnel quantity

func SetInVariance

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

SetInVariance sets the variance of a number of hops inbound

func SetKeyFile

func SetKeyFile(s string) func(*GitSAMTunnel) error

SetKeyFile sets

func SetLeaseSetKey

func SetLeaseSetKey(s string) func(*GitSAMTunnel) error

SetLeaseSetKey sets the host of the GitSAMTunnel's SAM bridge

func SetLeaseSetPrivateKey

func SetLeaseSetPrivateKey(s string) func(*GitSAMTunnel) error

SetLeaseSetPrivateKey sets the host of the GitSAMTunnel's SAM bridge

func SetLeaseSetPrivateSigningKey

func SetLeaseSetPrivateSigningKey(s string) func(*GitSAMTunnel) error

SetLeaseSetPrivateSigningKey sets the host of the GitSAMTunnel's SAM bridge

func SetMakePage added in v0.0.2

func SetMakePage(b bool) func(*GitSAMTunnel) error

SetMakePage tells the application to update the page

func SetMessageReliability

func SetMessageReliability(s string) func(*GitSAMTunnel) error

SetMessageReliability sets the host of the GitSAMTunnel's SAM bridge

func SetName

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

SetName sets the host of the GitSAMTunnel's SAM bridge

func SetOutBackups

func SetOutBackups(u int) func(*GitSAMTunnel) error

SetOutBackups sets the inbound tunnel backups

func SetOutLength

func SetOutLength(u int) func(*GitSAMTunnel) error

SetOutLength sets the number of hops outbound

func SetOutQuantity

func SetOutQuantity(u int) func(*GitSAMTunnel) error

SetOutQuantity sets the outbound tunnel quantity

func SetOutVariance

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

SetOutVariance sets the variance of a number of hops outbound

func SetPagePort

func SetPagePort(s string) func(*GitSAMTunnel) error

SetPagePort sets the port of the service to forward

func SetPubKeyPath

func SetPubKeyPath(s string) func(*GitSAMTunnel) error

SetPubKeyPath sets the path to the user's SSH public keys for read/write access.

func SetReduceIdle

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

SetReduceIdle tells the connection to reduce it's tunnels during extended idle time.

func SetReduceIdleQuantity

func SetReduceIdleQuantity(u int) func(*GitSAMTunnel) error

SetReduceIdleQuantity sets minimum number of tunnels to reduce to during idle time

func SetReduceIdleTime

func SetReduceIdleTime(u int) func(*GitSAMTunnel) error

SetReduceIdleTime sets the time to wait before reducing tunnels to idle levels

func SetReduceIdleTimeMs

func SetReduceIdleTimeMs(u int) func(*GitSAMTunnel) error

SetReduceIdleTimeMs sets the time to wait before reducing tunnels to idle levels in milliseconds

func SetSAMHost

func SetSAMHost(s string) func(*GitSAMTunnel) error

SetSAMHost sets the host of the GitSAMTunnel's SAM bridge

func SetSAMPort

func SetSAMPort(s string) func(*GitSAMTunnel) error

SetSAMPort sets the port of the GitSAMTunnel's SAM bridge using a string

func SetSSHPort

func SetSSHPort(s string) func(*GitSAMTunnel) error

SetSSHPort sets the port of the service to forward

func SetSaveFile

func SetSaveFile(b bool) func(*GitSAMTunnel) error

SetSaveFile tells the router to save the tunnel's keys long-term

func SetSecurePath

func SetSecurePath(s string) func(*GitSAMTunnel) error

SetSecurePath sets the path to place the private keys for server authentication.

func SetServeDir

func SetServeDir(s string) func(*GitSAMTunnel) error

SetServeDir sets the path to the directory you want to serve

func SetSigType

func SetSigType(s string) func(*GitSAMTunnel) error

SetSigType sets the type of the forwarder server

func SetType

func SetType(s string) func(*GitSAMTunnel) error

SetType sets the type of the forwarder server

Types

type GitSAMTunnel

type GitSAMTunnel struct {
	*samforwarder.SAMForwarder
	*gitkit.SSH
	GitConf    gitkit.Config
	OptPage    *eephttpd.EepHttpd
	PubKeyPath string
	SecurePath string
	PagePort   string
	// contains filtered or unexported fields
}

GitSAMTunnel is a structure which automatically configured the forwarding of a local service to i2p over the SAM API.

func NewGitSAMTunnel

func NewGitSAMTunnel(host, port string) (*GitSAMTunnel, error)

NewGitSAMTunnel makes a new SAM forwarder with default options, accepts host:port arguments

func NewGitSAMTunnelFromOptions

func NewGitSAMTunnelFromOptions(opts ...func(*GitSAMTunnel) error) (*GitSAMTunnel, error)

NewGitSAMTunnelFromOptions makes a new SAM forwarder with default options, accepts host:port arguments

func (*GitSAMTunnel) AssureGitIgnore

func (s *GitSAMTunnel) AssureGitIgnore() error

func (*GitSAMTunnel) AssurePostRecieve added in v0.0.2

func (s *GitSAMTunnel) AssurePostRecieve() error

func (*GitSAMTunnel) Close

func (f *GitSAMTunnel) Close() error

Close shuts the whole thing down.

func (*GitSAMTunnel) DeletePostRecieve added in v0.0.2

func (s *GitSAMTunnel) DeletePostRecieve() error

func (*GitSAMTunnel) GetType

func (f *GitSAMTunnel) GetType() string

func (*GitSAMTunnel) ListDirs added in v0.0.992

func (s *GitSAMTunnel) ListDirs() ([]os.FileInfo, error)

func (*GitSAMTunnel) Load

func (s *GitSAMTunnel) Load() (samtunnel.SAMTunnel, error)

func (*GitSAMTunnel) LookupKey

func (f *GitSAMTunnel) LookupKey(content string) (*gitkit.PublicKey, error)

func (*GitSAMTunnel) PRBytes added in v0.0.2

func (s *GitSAMTunnel) PRBytes() []byte

func (*GitSAMTunnel) PUBytes added in v0.0.993

func (s *GitSAMTunnel) PUBytes() []byte

func (*GitSAMTunnel) Serve

func (f *GitSAMTunnel) Serve() error

Serve starts the SAM connection and and forwards the local host:port to i2p

func (*GitSAMTunnel) ServePage

func (f *GitSAMTunnel) ServePage()

func (*GitSAMTunnel) ServeParent

func (f *GitSAMTunnel) ServeParent()

func (*GitSAMTunnel) Up

func (f *GitSAMTunnel) Up() bool

type Option

type Option func(*GitSAMTunnel) error

Option is a GitSAMTunnel Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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