mullsox

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: MIT Imports: 10 Imported by: 0

README

mullsox

GoDoc Go Report Card IRC

mullsox is an overengineered toolkit to work with the mullvad API. It's designed for use when already connected to a mullvad VPN endpoint.

More specifically, it was built to help the user make use of all of the SOCKS proxies that are available via the internal 10.0.0.0/8 subnet while connected to mullvad servers. this allows you to utilize somewhere around 75-100 different outgoing IP addresses via SOCKS proxies all while only connected to one mullvad VPN server.

5 5 5 5 5

mullsox works great with prox5.

example of usage with prox5:

p5 := NewProxyEngine()
mc := mullsox.NewChecker()

if err := mc.Update(); err != nil {
	println(err.Error())
        return
}

incoming, _ := mc.GetAndVerifySOCKS()

var count = 0
for line := range incoming {
        if p5.LoadSingleProxy(line.String()) {
                count++
        }
}

if count == 0 {
        println("failed to load any proxies")
        return
}

if err := p5.Start(); err != nil {
        println(err.Error())
        return
}

Documentation

Index

Constants

View Source
const (
	EndpointCheck4 = endpointv4Prefix + baseEndpoint + endpointJSON
	EndpointCheck6 = endpointv6Prefix + baseEndpoint + endpointJSON
	EndpointRelays = `https://api.` + baseDomain + `/www/relays/all/`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

func NewChecker

func NewChecker() *Checker

func (*Checker) Add

func (c *Checker) Add(server MullvadServer)

func (*Checker) AmIMullvad

func (c *Checker) AmIMullvad(ctx context.Context) (MullvadServer, error)

AmIMullvad checks if you are currently connecting through a Mullvad relay. Returns the mullvad server you are connected to if any, and any error that occured

func (*Checker) Get

func (c *Checker) Get(hostname string) MullvadServer

func (*Checker) GetAndVerifySOCKS

func (c *Checker) GetAndVerifySOCKS() (chan netip.AddrPort, chan error)

func (*Checker) GetSOCKS

func (c *Checker) GetSOCKS() (sox []netip.AddrPort, err error)

func (*Checker) Has

func (c *Checker) Has(hostname string) bool

func (*Checker) Slice

func (c *Checker) Slice() []MullvadServer

func (*Checker) Update

func (c *Checker) Update() error

type IPDetails

type IPDetails struct {
	IP                    string  `json:"ip"`
	Country               string  `json:"country"`
	City                  string  `json:"city"`
	Longitude             float64 `json:"longitude"`
	Latitude              float64 `json:"latitude"`
	MullvadExitIP         bool    `json:"mullvad_exit_ip"`
	MullvadExitIPHostname string  `json:"mullvad_exit_ip_hostname"`
	MullvadServerType     string  `json:"mullvad_server_type"`
	Blacklisted           struct {
		Blacklisted bool `json:"blacklisted"`
		Results     []struct {
			Name        string `json:"name"`
			Link        string `json:"link"`
			Blacklisted bool   `json:"blacklisted"`
		} `json:"results"`
	} `json:"blacklisted"`
	Organization string `json:"organization"`
}

func CheckIP4

func CheckIP4() (details *IPDetails, err error)

func CheckIP6

func CheckIP6() (details *IPDetails, err error)

type MullvadServer

type MullvadServer struct {
	Hostname             string        `json:"hostname"`
	CountryCode          string        `json:"country_code"`
	CountryName          string        `json:"country_name"`
	CityCode             string        `json:"city_code"`
	CityName             string        `json:"city_name"`
	Active               bool          `json:"active"`
	Owned                bool          `json:"owned"`
	Provider             string        `json:"provider"`
	Ipv4AddrIn           string        `json:"ipv4_addr_in"`
	Ipv6AddrIn           *string       `json:"ipv6_addr_in"`
	NetworkPortSpeed     int           `json:"network_port_speed"`
	Stboot               bool          `json:"stboot"`
	Type                 string        `json:"type"`
	StatusMessages       []interface{} `json:"status_messages"`
	Pubkey               string        `json:"pubkey,omitempty"`
	MultihopPort         int           `json:"multihop_port,omitempty"`
	SocksName            string        `json:"socks_name,omitempty"`
	SocksPort            int           `json:"socks_port,omitempty"`
	Ipv4V2Ray            *string       `json:"ipv4_v2ray,omitempty"`
	SshFingerprintSha256 string        `json:"ssh_fingerprint_sha256,omitempty"`
	SshFingerprintMd5    string        `json:"ssh_fingerprint_md5,omitempty"`
}

func (MullvadServer) String

func (mvs MullvadServer) String() string

type MyIPDetails

type MyIPDetails struct {
	V4 *IPDetails `json:"ipv4,omitempty"`
	V6 *IPDetails `json:"ipv6,omitempty"`
}

func CheckIP

func CheckIP(ctx context.Context) (*MyIPDetails, error)

Jump to

Keyboard shortcuts

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