Re: [go-nuts] How to read (and write) the ECN bits?

2020-08-05 Thread Andrei Tudor Călin
ECN bits are represented in the TOS field. I think you can use setsockopt with the IP_TOS option to set the TOS field on a socket. See ip(7). On the Go side, use the SyscallConn method on your UDPConn, then call setsockopt using the Control method. Something like this (untested):

Re: [go-nuts] Binary generated from jenkins pipeline throwing error in linux box while running - netpoll failed

2020-08-05 Thread Andrei Tudor Călin
Go requires Linux 2.6.23 or later. On Wed, Aug 5, 2020 at 7:47 AM Ravi Kant Soni wrote: > It's, where trying to run Binary > > -Linux version 2.6.18 > > -Red Hat Enterprise Linux Server release 5.11 > > Jenkins, where Binary generated > > -RHEL 7.8 > > -Linux 3.10.0 > > -- > You received this

Re: [go-nuts] How do you write "member" with the proposed generics draft?

2020-08-04 Thread Andrei Tudor Călin
I feel like https://go2goplay.golang.org/p/RLn9BXjU1OR is a better compromise than having two functions. On Tue, Aug 4, 2020 at 5:50 PM 'Axel Wagner' via golang-nuts < golang-nuts@googlegroups.com> wrote: > No, that's not possible. A generic function can only work with *either* > built in

Re: [go-nuts] [Generics] Constraints package name

2020-07-27 Thread Andrei Tudor Călin
The entire notion of the constraints package feels a little suspicious to me. What if the comparable and ordered constraints were pre-declared in the universe block, and the numeric constraint were named math.Numeric? What other universal (or close to universal) constraints would belong in this

Re: [go-nuts] minimum linux kernel version that can run latest golang

2020-07-25 Thread Andrei Tudor Călin
2.6.23, for most architectures, as far as I know. On Sat, Jul 25, 2020 at 8:31 AM xie cui wrote: > what is the minimum version of linux kernel that can run golang? > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from

Re: [go-nuts] Clean shutdown when blocked on I/O

2020-07-08 Thread Andrei Tudor Călin
, Jul 8, 2020 at 1:43 PM Brian Candler wrote: > On Wednesday, 8 July 2020 11:17:56 UTC+1, Andrei Tudor Călin wrote: >> >> I think this works for some cases, but it is potentially wasteful (and >> even leaky) in terms of resource usage. >> >> For example, if ctx

Re: [go-nuts] Clean shutdown when blocked on I/O

2020-07-08 Thread Andrei Tudor Călin
I think this works for some cases, but it is potentially wasteful (and even leaky) in terms of resource usage. For example, if ctx is context.Background(), it leaks a goroutine for every connection. It also keeps the additional goroutine around for the entire lifetime of the connection. I'd like

Re: [go-nuts] Worker Pool vs. New Goroutine For Each Task

2020-07-03 Thread Andrei Tudor Călin
Check out Bryan's talk[0], in particular from ~27:00 onward, where worker pools are discussed. I highly recommend the entire talk. [0] https://www.youtube.com/watch?v=5zXAHh5tJqQ On Fri, Jul 3, 2020 at 5:03 PM Atakan Çolak wrote: > Hiya everyone, > > I have a simple processor function that

Re: [go-nuts] [design] HTTP server serving heavy computing : Handle HTTP request closed prematurely

2020-06-19 Thread Andrei Tudor Călin
Goroutines can only be stopped if they cooperate. They have no user-facing identity or a handle by which they can be stopped. To cooperate, they need to be checking some kind of cancellation flag or channel, periodically. These days, for HTTP servers, that channel is the request context, since

Re: [go-nuts] Re: How can stop a Read of net.Conn without closing it

2020-05-11 Thread Andrei Tudor Călin
That would work, yes. net/http, for example, has var aLongTimeAgo = time.Unix(1, 0), which is used for cancellation. On Mon, May 11, 2020 at 4:47 AM wrote: > > > On Wednesday, June 5, 2019 at 10:14:22 AM UTC-4, Ian Lance Taylor wrote: >> >> On Wed, Jun 5, 2019 at 12:10 AM Kurtis Rader >>

Re: [go-nuts] How to limit client IPs in tls listener?

2019-03-15 Thread Andrei Tudor Călin
019 at 10:07:57 PM UTC+8, Andrei Tudor Călin wrote: >> >> Here is a rough sketch: >> >> type allowedIPsListener struct { >> allowed []net.IP >> inner net.Listener >> } >> >> func (ln *allowedIPsListener) Accept() (

Re: [go-nuts] How to limit client IPs in tls listener?

2019-03-15 Thread Andrei Tudor Călin
issue as I do with tls? > > On Friday, March 15, 2019 at 9:46:00 PM UTC+8, Andrei Tudor Călin wrote: >> >> Begin by implementing a `net.Listener` which checks the list of allowed >> IPs. >> You'll be able to run code before the connection is passed on to >> crypt

Re: [go-nuts] How to limit client IPs in tls listener?

2019-03-15 Thread Andrei Tudor Călin
tls connection when a client sends SYN? > > Thanks in advance. > -- Andrei Tudor Călin -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+u

Re: [go-nuts] Persistence of value, or Safely close what you expected

2019-03-13 Thread Andrei Tudor Călin
but if I use just > > close(c) > > all bets are off, just like in a current Go code? I think this would be > perfectly code-compatible with an "old" code, keeping Go1 compatibility > guarantee untouched. > > Thank you very much, >Andrey > --

Re: [go-nuts] does assembly pay the cgo transition cost / does runtime.LockOSThread() make CGO calls faster?

2019-03-01 Thread Andrei Tudor Călin
Perhaps https://github.com/minio/c2goasm might be of interest. I don't see anything in there about Fortran specifically, but I don't think it would be a huge leap. On Fri, Mar 1, 2019 at 5:13 PM Jason E. Aten wrote: > If I include a chunk of assembly .s code in my Go code, does my program >

[go-nuts] Re: googleable guru doc page?

2018-11-04 Thread Andrei Tudor Călin
The godoc at https://godoc.org/golang.org/x/tools/cmd/guru links to http://golang.org/s/using-guru which redirects to a document describing what guru can do. On Sunday, November 4, 2018 at 6:18:42 AM UTC+1, Jeff Hodges wrote: > > Hey, I just googled "guru golang" and "go guru" and wasn't able to

[go-nuts] Re: Is it possible to unmarshall Json by selecting the struct from a field in the Json?

2018-03-28 Thread Andrei Tudor Călin
It isn't really possible to do so because there is no nice and type safe way of getting from a string in the JSON to a Go type, and a value of said type. You must write a little bit of extra code. This article: http://eagain.net/articles/go-dynamic-json/ presents a good approach. On Wednesday,

[go-nuts] Re: Error type casting is something strange.

2017-02-26 Thread Andrei Tudor Călin
Hello. If any concrete value has been stored in an interface value - including a nil pointer of some type - the interface will not be nil. See this section in the FAQ for more details: https://golang.org/doc/faq#nil_error On Sunday, February 26, 2017 at 6:06:16 PM UTC+1, 장재휴 wrote: > > Hi. >

[go-nuts] Re: Eliminating redundant map lookups

2016-11-27 Thread Andrei Tudor Călin
In general, a good way to answer questions like this is to inspect an assembly listing for the code. This is what I compiled: $ cat foo.go package foo import ( "fmt" ) type Person struct { Name string Likes []string } func foo() { var people []*Person likes := make(map[string][]*Person) for