![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
github.com/vikrammel/golang-ipsorting
git clone into ~/go/src
or download .go
files and place in ~/go/src/ipsorting
:
git clone https://github.com/Vikrammel/golang-ipsorting.git
if vendoring, place .go
files in <projectroot>/app/vendor/ipsorting
import package in code:
import (
"ipsorting"
)
use on string or an array/slice of strings of ip:ports (ipsorting.go can be easily modified to work with just IPs instead of IP:Port)
compare two IP:Ports
sortedPair := ipsorting.OrderIPPair("10.0.0.14:8080", "10.0.0.14:5060")
//sortedPair is now a string array literal of size 2 of the two ip:port strings passed in
//in ascending numerical order
log.Println(sortedPair[0])
//10.0.0.14:5060
sort a slice of IP:Ports
//unsortedList = ["10.0.0.24:8080", "10.0.0.21:8080", "10.0.0.22:8080", "10.0.0.23:8080"]
sortedList := ipsorting.SortIPs(unsortedList)
log.Println(sortedList)
//["10.0.0.21:8080", "10.0.0.22:8080", "10.0.0.23:8080", "10.0.0.24:8080"]
//ports do not need to be the same, they will also be compared
//adapted quickSort, avg complexity = O(nlog(n)), worst case = O(n^2)
insert IP:Port into slice in correct position
//sortedList = ["10.0.0.21:8080", "10.0.0.22:8080", "10.0.0.23:8080", "10.0.0.24:8080"]
sortedList = ipsorting.InsortIP(sortedList, "10.0.0.23:8070")
log.Println(sortedList)
//["10.0.0.21:8080", "10.0.0.22:8080", "10.0.0.23:8070", "10.0.0.23:8080", "10.0.0.24:8080"]
//adapted binarySearch, complexity = O(log(n))
Binary Search [for InsortIP()]
Feel free to use this in any of your projects and please let me know if you encounter any bugs. Thank you.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.