Golang API for proxybonanza.com
Go to file
kayos@tcp.direct 11a2eeb267
Fix: nil deref panic
2023-07-18 21:03:02 -07:00
cmd Fix typo 2022-10-30 06:15:02 -07:00
internal Fix: nil deref panic 2023-07-18 21:03:02 -07:00
.gitignore Add new example 2022-05-22 18:43:46 -07:00
LICENSE Update README.md, Add: License 2021-12-09 03:35:30 -08:00
README.md Improve efficiency of existing methods and add new methods 2022-07-17 21:13:14 -07:00
actions.go Improve efficiency of existing methods and add new methods 2022-07-17 21:13:14 -07:00
api.go Improve efficiency of existing methods and add new methods 2022-07-17 21:13:14 -07:00
go.mod init 2021-12-09 03:30:43 -08:00
requests.go Fix: nil pointer dereference 2022-09-30 13:18:36 -07:00

ProxyGonanza

GoDoc Go Report Card

Table of Contents

  1. ProxyGonanza
    1. Import Path
    2. Constants and Variables
    3. API Types
      1. type AddAuthIPResponse
      2. type AuthIP
      3. type AuthIPResponse
      4. type DelAuthIPResponse
      5. type Package
      6. type PackageDetails
      7. type PackageResponse
      8. type PackageStatistics
      9. type UserPackage
    4. Client
      1. type APIClient
      2. Constructors
        1. func NewAPIClient
        2. func NewCustomClient
      3. Methods
        1. func (*APIClient) AddAuthIP
        2. func (*APIClient) AddCurrentIPtoAllPackages
        3. func (*APIClient) DeleteAllAuthIPs
        4. func (*APIClient) DeleteAuthIPByID
        5. func (*APIClient) DeleteAuthIPByIP
        6. func (*APIClient) DeleteOtherAuthIPs
        7. func (*APIClient) GetAllSOCKSIPsAndPorts
        8. func (*APIClient) GetAuthIPs
        9. func (*APIClient) GetPackageSOCKS
        10. func (*APIClient) GetProxyPackages

Import Path

import "git.tcp.direct/kayos/proxygonanza"

Constants and Variables

const (
	APIBaseURL = "https://proxybonanza.com/api/v1/"
)

API Types

type AddAuthIPResponse

type AddAuthIPResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
	Data    struct {
		ID int `json:"id"`
	} `json:"data"`
}

AddAuthIPResponse represents an API response from proxybonanza.com.

type AuthIP

type AuthIP struct {
	UserpackageID int         `json:"userpackage_id"`
	ID            interface{} `json:"id"`
	IP            string      `json:"ip"`
}

AuthIP is an IP address authorized to use the proxies in the related package.

type AuthIPResponse

type AuthIPResponse struct {
	Success    bool       `json:"success"`
	Message    string     `json:"message"`
	AuthIPData []AuthIP   `json:"data"`
	Pages      pagination `json:"pagination"`
}

AuthIPResponse represents an API response from proxybonanza.com.

type DelAuthIPResponse

type DelAuthIPResponse struct {
	Success bool `json:"success"`
}

DelAuthIPResponse represents an API response from proxybonanza.com.

type Package

type Package struct {
	ID           int
	AuthIPs      []AuthIP
	AllTimeStats PackageStatistics
	HourlyStats  map[time.Time]PackageStatistics
}

Package contains what we know about a particular proxybonanza package.

type PackageDetails

type PackageDetails struct {
	Name               string      `json:"name"`
	Bandwidth          int64       `json:"bandwidth"`
	Price              interface{} `json:"price"`
	HowmanyIPs         int         `json:"howmany_ips"`
	PricePerGig        interface{} `json:"price_per_gig"`
	PackageType        string      `json:"package_type"`
	HowmanyAuthips     int         `json:"howmany_authips"`
	IPType             int         `json:"ip_type"`
	PriceUserFormatted string      `json:"price_user_formatted"`
}

PackageDetails represents an API response from proxybonanza.com containing proxy package information.

type PackageResponse

type PackageResponse struct {
	Success     bool          `json:"success"`
	Message     string        `json:"message"`
	PackageData []UserPackage `json:"data"`
	Pages       pagination    `json:"pagination"`
}

PackageResponse represents an API response from proxybonanza.com containing proxy package information.

type PackageStatistics

type PackageStatistics struct {
	UserpackageID int    `json:"userpackage_id"`
	Date          string `json:"date"`
	BndHTTP       int    `json:"bnd_http"`
	ConnHTTP      int    `json:"conn_http"`
	BndSocks      int    `json:"bnd_socks"`
	ConnSocks     int    `json:"conn_socks"`
	BndTotal      int    `json:"bnd_total"`
	ConnTotal     int    `json:"conn_total"`
}

PackageStatistics represents the statistics for the related proxy package.

type UserPackage

type UserPackage struct {
	ID         int         `json:"id"`
	CustomName interface{} `json:"custom_name"`
	Login      string      `json:"login"`
	Password   string      `json:"password"`
	Expires    time.Time   `json:"expires"`
	Bandwidth  int64       `json:"bandwidth"`

	LowBanwidthNotificationPercent int            `json:"low_banwidth_notification_percent"`
	Package                        PackageDetails `json:"package"`
	BandwidthGb                    float64        `json:"bandwidth_gb"`
	AdditionalBandwidthGb          float64        `json:"additional_bandwidth_gb"`
	BandwidthPercentLeftHuman      string         `json:"bandwidth_percent_left_human"`
	ExpirationDateHuman            string         `json:"expiration_date_human"`
	Name                           string         `json:"name"`
}

UserPackage represents a proxy package purchased from proxybonanza.com.

Client

type APIClient

type APIClient struct {
	Key           string
	KnownPackages map[int]PackageDetails
	Debug         bool
}

APIClient is a client for ProxyBonanza.com.

Constructors

func NewAPIClient

func NewAPIClient(key string) *APIClient

NewAPIClient instantiates a proxybonanza.com API client with the given key using golang's default http client.

func NewCustomClient

func NewCustomClient(key string, client *http.Client) *APIClient

NewCustomClient insantiates a proxybonanza API client with the given key and the given http.Client.

Methods

func (*APIClient) AddAuthIP

func (api *APIClient) AddAuthIP(ip net.IP, packageID int) (AddAuthIPResponse, error)

AddAuthIP adds a new IP to the corresponding/provided proxy package ID.

func (*APIClient) AddCurrentIPtoAllPackages

func (api *APIClient) AddCurrentIPtoAllPackages() (success int)

AddCurrentIPtoAllPackages adds your current WAN IP to all packages on your account. It returns the amount of successful packages that it was applied to. It will skip packages that are already using the current IP.

func (*APIClient) DeleteAllAuthIPs

func (api *APIClient) DeleteAllAuthIPs() (int, error)

DeleteAllAuthIPs deletes all authenticaiton IPs from your account.

func (*APIClient) DeleteAuthIPByID

func (api *APIClient) DeleteAuthIPByID(ipID int) (ok bool)

DeleteAuthIPByID deletes an authentication IP with the matching ID provided

func (*APIClient) DeleteAuthIPByIP

func (api *APIClient) DeleteAuthIPByIP(ipa net.IP) (err error)

DeleteAuthIPByIP will iterate through all the authips on your account and delete one that matches the given IP.

func (*APIClient) DeleteOtherAuthIPs

func (api *APIClient) DeleteOtherAuthIPs() ([]int, error)

DeleteOtherAuthIPs deletes all authenticaiton IPs from your account's packages that do not match your current IP address. Returns a slice of authentication IP IDs that were deleted and any errors that occurred.

func (*APIClient) GetAllSOCKSIPsAndPorts

func (api *APIClient) GetAllSOCKSIPsAndPorts() ([]string, error)

GetAllSOCKSIPsAndPorts will return a slice of IP:Port formatted proxy strings

func (*APIClient) GetAuthIPs

func (api *APIClient) GetAuthIPs() ([]AuthIP, error)

GetAuthIPs gets all authentication IPs active on your account.

func (*APIClient) GetPackageSOCKS

func (api *APIClient) GetPackageSOCKS(packageid int) ([]string, error)

GetPackageSOCKS returns a specified packages SOCKS5 proxies in host:port format.

func (*APIClient) GetProxyPackages

func (api *APIClient) GetProxyPackages() ([]UserPackage, error)

GetProxyPackages gets current proxy packages from your account.