GoCycle

package module
v0.0.0-...-f1b2fac Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

README

GoCycle Banner

GoCycle

Efficient cycle list manager with locking and deduplication for Go.

Installation

go get github.com/0dev1337/GoCycle

Usage

package main

import (
	"time"
	"github.com/0dev1337/GoCycle"
)

func main() {
	// Load proxies from file
	cycle, err := GoCycle.NewFromFile("proxies.txt") // Or use: GoCycle.New(&[]string{"a", "b", "c"})

	if err != nil {
		panic("Can't open proxy file")
	}

	// Remove all duplicate items
	cycle.ClearDuplicates()

	// Lock the element "a" for 5 seconds
	go cycle.LockByTimeout("a", 5*time.Second)

	// Lock an element manually
	cycle.Lock("a")

	// Unlock the element
	cycle.Unlock("a")

	// Check if element is locked
	locked := cycle.IsLocked("a")

	// Check if element exists in the list
	inList := cycle.IsInList("a")

	// Retrieve the next available element
	next := cycle.Next()

	// Remove an element from the list
	cycle.Remove("a")

	// Combine multiple cycles into one
	cycle.CombineCycles(cycle1, cycle2, cycle33)

	// Get the length of the cycle list
	length := cycle.ListLength()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cycle

type Cycle struct {
	Mutex  *sync.Mutex
	Locked []string
	List   []string
	I      int

	WaitTime time.Duration
}

func CombineCycles

func CombineCycles(c1, c2, c3 *Cycle) *Cycle

func New

func New(List *[]string) *Cycle

func NewFromFile

func NewFromFile(Path string) (*Cycle, error)

func (*Cycle) ClearDuplicates

func (c *Cycle) ClearDuplicates() int

func (*Cycle) IsInList

func (c *Cycle) IsInList(Element string) bool

fuck duplicate code i care dont bully me

func (*Cycle) IsLocked

func (c *Cycle) IsLocked(Element string) bool

func (*Cycle) ListLength

func (c *Cycle) ListLength() int

func (*Cycle) Lock

func (c *Cycle) Lock(Element string)

func (*Cycle) LockByTimeout

func (c *Cycle) LockByTimeout(Element string, Timeout time.Duration)

func (*Cycle) Next

func (c *Cycle) Next() string

func (*Cycle) Remove

func (c *Cycle) Remove(Element string)

func (*Cycle) Unlock

func (c *Cycle) Unlock(Element string)

Jump to

Keyboard shortcuts

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