Raw Socket Wrapper is a Go library designed to simplify the interface for creating and manipulating raw network packets. It supports various protocols and provides utilities for packet serialization and randomization.
- Protocol Support: Facilitates the creation and manipulation of TCP, UDP, and ICMP packets.
- Packet Serialization: Provides utilities to serialize packets for transmission.
- Randomization Utilities: Includes functions to generate random ports, timestamps, and byte slices for networking.
To use the IP Iterator, you can import the RawSocket package in your Go project:
import "github.com/SyNdicateFoundation/RawSocketWrapper/RawSocket"The IPIterator struct represents an iterator over a collection of IP addresses. You can create a new instance of IPIterator using the ToIPIterator function:
iterator := RawSocket.ToIPIterator("100.0.0.0/12", "192.168.1.1-192.168.1.10")The Next method returns the next IP address in the iterator:
for iterator.HasNext() {
ip := iterator.Next()
// Do something with the IP address
fmt.Println(ip)
}You can also shuffle the order of the IP addresses in the iterator using the Shuffle method:
iterator.Shuffle()github.com/google/gopacket: A Go library for packet processing.golang.org/x/sys: Provides low-level operating system primitives.
The IPIterator struct has the following methods:
ToIPIterator(data ...string) *IPIterator: Creates a new instance ofIPIteratorwith the given data.Next() net.IP: Returns the next IP in the iterator.Shuffle(): Shuffles the order of the IP addresses in the iterator.SetSkipLocal(b bool): Sets theskipLocalflag to the given value.HasNext() bool: Returnstrueif there is a next IP address in the iterator.
Contributions are welcome! If you're interested in improving RawSocketWrapper, please feel free to make a pull request or open an issue.