[go-nuts] Re: Divide up CIDR block into smaller subnets

2018-05-09 Thread aroman
Oh no, nevermind: https://github.com/EvilSuperstars/go-cidrman/blob/master/subnet.go :-( On Wednesday, May 9, 2018 at 10:37:54 AM UTC-6, Augusto Roman wrote: > > https://godoc.org/github.com/ewbankkit/go-cidrman#Subnets > > On Wednesday, May 9, 2018 at 6:48:46 AM UTC-6, Anik Mazumder wrote: >>

[go-nuts] Re: Divide up CIDR block into smaller subnets

2018-05-09 Thread aroman
https://godoc.org/github.com/ewbankkit/go-cidrman#Subnets On Wednesday, May 9, 2018 at 6:48:46 AM UTC-6, Anik Mazumder wrote: > > I would like to divide up a CIDR block into smaller subnets. > > For example if the CIDR block is 10.0.0.0/4, then I would like to spilt > is up into multiple /8s. >

[go-nuts] Re: Is it possible to determine total number of bytes read/written for an HTTP request? (including headers)

2018-01-29 Thread aroman
Thanks! I'm not willing close the connection on every request -- that's too painful. I don't need an _exact_ count, but I want to be confident that my counts are really close. Serializing the headers and adding the size of the body is the closest that I've come up with to do accurate per-reque

[go-nuts] Re: Is it possible to determine total number of bytes read/written for an HTTP request? (including headers)

2018-01-25 Thread aroman
Interesting. I wouldn't expect kernel functions to give me per-request statistics, however, I'd expect per-process (or if I'm lucky per-thread) statistics. Is that what you were imagining? On Thursday, January 25, 2018 at 5:19:02 PM UTC-7, simon place wrote: > > i think there should be several

[go-nuts] Re: Is it possible to determine total number of bytes read/written for an HTTP request? (including headers)

2018-01-23 Thread aroman
Huh. Is this actually not possible? (That is, without modifying net/http directly?) On Friday, January 19, 2018 at 12:47:06 PM UTC-7, Augusto Roman wrote: > > I'm interested in tracking total bandwidth on a per-request basis. It's > easy to intercept the ResponseWriter and track the number of

[go-nuts] Is it possible to determine total number of bytes read/written for an HTTP request? (including headers)

2018-01-19 Thread aroman
I'm interested in tracking total bandwidth on a per-request basis. It's easy to intercept the ResponseWriter and track the number of bytes sent out for the response body, and it's easy to intercept the Request.Body to count the number of bytes read from the remote source, but both of these igno

[go-nuts] Re: reflect, is it possible to get the [body + sign] of a func as text at runtime ?

2016-09-17 Thread aroman
Use the Type: reflect.Value.Type.String: https://play.golang.org/p/dlwjCROG6H On Saturday, September 17, 2016 at 3:53:35 AM UTC-7, mhhcbon wrote: > > Hi, > > i m wondering if one can use reflect to extract at runtime the body and > and signature of a Func or 'Public method' ? > Will a reflect.Va

Re: [go-nuts] Having difficulty testing this "cleanly"

2016-09-13 Thread aroman
t;> >>> >>> We actually don't care if "Handle" completes in this example. We only >>> care if that our task handler starts processing a message that it completes >>> the processing. >>> >>> >>> >>> Than

Re: [go-nuts] Having difficulty testing this "cleanly"

2016-09-13 Thread aroman
en because you can't guarantee >> that the tasks are all started (and have a read-lock acquired) before you >> call close. >> >> >> >> Consider: >> >> h.Handle(...) <-- gets past the closed channel check, calls go ..., >> butthe

Re: [go-nuts] Having difficulty testing this "cleanly"

2016-09-13 Thread aroman
) is called and the goroutine starts, you always might miss a task that got called near the time Close() was called. - Augusto On Tuesday, September 13, 2016 at 12:50:50 PM UTC-7, Evan Digby wrote: > > Hi Aroman, > > Your approach using the WaitGroup is definitely better in this toy

Re: [go-nuts] Having difficulty testing this "cleanly"

2016-09-13 Thread aroman
The WaitGroup is better than the lock approach, since the lock approach could block an outstanding task. The key to using waitgroups is to call Add() outside of goroutines that might call done: https://play.golang.org/p/QVWoy8fCmI On Tuesday, September 13, 2016 at 12:19:16 PM UTC-7, Evan Digby

[go-nuts] Re: Type Scope?

2016-09-13 Thread aroman
That's correct. Method receivers are equivalent to just passing as an extra argument: func Set(f fetcher, tname string) { f.names = tname } In this case, it's obvious that Set will not affect the fetcher passed in at the call site, in contrast to func Set(f *fetcher, tname string) { f.names =

[go-nuts] Re: Type Scope?

2016-09-13 Thread aroman
You need a pointer receiver on Set. It copies the struct, sets the field on the copy, and throws it away: https://play.golang.org/p/mqleaL6PU3 On Tuesday, September 13, 2016 at 11:41:46 AM UTC-7, Frank Davidson wrote: > > I think I'm having some type of mental lapse, but can anyone tell me why

Re: [go-nuts] What 5 things does Go need in 2017?

2016-09-11 Thread aroman
There's also decimal128 support (first via a third-party library before inclusion into the language itself): https://github.com/golang/go/issues/12332 =) - Augusto On Sunday, September 11, 2016 at 5:01:21 PM UTC-7, Pablo Rozas-Larraondo wrote: > > Hi Mark, > > I can also suggest you to look in

[go-nuts] Re: time.After faster than goroutine?

2016-09-04 Thread aroman
On Saturday, September 3, 2016 at 10:09:09 PM UTC-7, Dave Cheney wrote: > > Your not seeding the random generator so the results should be identical > each time. Except that the random numbers are being assigned in goroutines that are racing each other. On my system, at least one of the two go