[go-nuts] schollz/peerdiscovery - Pure-Go library for cross-platform local peer discovery using UDP broadcast

2018-04-23 Thread zack . scholl
After a few hours of mild hair pulling with trying to get the pkg/net ReadFromUDP to work between Windows and Linux, I eventually just went with golang.org/x/net/ipv4 to write this little library that can be used for local p

[go-nuts] Re: Problem using ReadFromUDP on Windows to discover local peers

2018-04-23 Thread zack . scholl
I got it working! Got it working with golang.org/x/net/ipv4, for some reason the pkg/net ReadFromUDP just didn't work. On Monday, April 23, 2018 at 12:07:07 AM UTC-7, zack@gmail.com wrote: > > I wrote a library (schollz/peerdiscovery > ) for discover

[go-nuts] Problem using ReadFromUDP on Windows to discover local peers

2018-04-23 Thread zack . scholl
I wrote a library (schollz/peerdiscovery ) for discovering peers on a local network. I've tested it between a wireless ubuntu laptop and a wired ubuntu server and it works great. Basically you can run the following on computer 1 and computer 2: go g

[go-nuts] Re: Why is there a slow-down to split one method of a struct pointer into two methods?

2017-10-08 Thread Zack Scholl
Why does it slow down the code if its not inlined? Since the method is on a pointer struct I assume it wouldn't need to copy anything? I'd like to not use inlining because I need the code of this function to be used by two different functions and would rather not have to update the code twice e

[go-nuts] Why is there a slow-down to split one method of a struct pointer into two methods?

2017-10-08 Thread zack . scholl
Why is it that when I a method on an struct pointer, like func (s *Object) process(inputs []byte) { for _, i := range inputs { // Lots of code } } it will slow down *a lot* if I move // Lots of code to its own function? I.e. I reorganize the above program two use two methods,

Re: [go-nuts] Is there a way to do bufio.ReadByte() starting at the end of a Reader?

2017-08-04 Thread zack . scholl
Thanks, this looks great On Friday, August 4, 2017 at 10:34:41 AM UTC-6, rog wrote: > > Ah, and I just found another version, somewhat simpler, > that just reads bytes in reverse: > > https://play.golang.org/p/mYsP7iHmiW > > > On 4 August 2017 at 16:43, roger peppe > > wrote: > > I wrote this

[go-nuts] Is there a way to do bufio.ReadByte() starting at the end of a Reader?

2017-08-04 Thread zack . scholl
I'm working on a finite state machine that processes a file byte by byte, without loading the entire file into memory. Currently it works in the forward direction, but I'd like to get it working in the reverse direction as well. Currently I make a *bufio.Readerfrom a open file / response body