package msg import ( "fmt" "net" "time" tap "github.com/dnstap/golang-dnstap" ) var ( protoUDP = tap.SocketProtocol_UDP protoTCP = tap.SocketProtocol_TCP familyINET = tap.SocketFamily_INET familyINET6 = tap.SocketFamily_INET6 ) // SetQueryAddress adds the query address to the message. This also sets the SocketFamily and SocketProtocol. func SetQueryAddress(t *tap.Message, addr net.Addr) error { t.SocketFamily = &familyINET switch a := addr.(type) { case *net.TCPAddr: t.SocketProtocol = &protoTCP t.QueryAddress = a.IP p := uint32(a.Port) t.QueryPort = &p if a.IP.To4() == nil { t.SocketFamily = &familyINET6 } return nil case *net.UDPAddr: t.SocketProtocol = &protoUDP t.QueryAddress = a.IP p := uint32(a.Port) t.QueryPort = &p if a.IP.To4() == nil { t.SocketFamily = &familyINET6 } return nil default: return fmt.Errorf("unknown address type: %T", a) } } // SetResponseAddress the response address to the message. This also sets the SocketFamily and SocketProtocol. func SetResponseAddress(t *tap.Message, addr net.Addr) error { t.SocketFamily = &familyINET switch a := addr.(type) { case *net.TCPAddr: t.SocketProtocol = &protoTCP t.ResponseAddress = a.IP p := uint32(a.Port) t.ResponsePort = &p if a.IP.To4() == nil { t.SocketFamily = &familyINET6 } return nil case *net.UDPAddr: t.SocketProtocol = &protoUDP t.ResponseAddress = a.IP p := uint32(a.Port) t.ResponsePort = &p if a.IP.To4() == nil { t.SocketFamily = &familyINET6 } return nil default: return fmt.Errorf("unknown address type: %T", a) } } // SetQueryTime sets the time of the query in t. func SetQueryTime(t *tap.Message, ti time.Time) { qts := uint64(ti.Unix()) qtn := uint32(ti.Nanosecond()) t.QueryTimeSec = &qts t.QueryTimeNsec = &qtn } // SetResponseTime sets the time of the response in t. func SetResponseTime(t *tap.Message, ti time.Time) { rts := uint64(ti.Unix()) rtn := uint32(ti.Nanosecond()) t.ResponseTimeSec = &rts t.ResponseTimeNsec = &rtn } // SetType sets the type in t. func SetType(t *tap.Message, typ tap.Message_Type) { t.Type = &typ } '>create-constructors-when-needed Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/integration/snippets/number-literal-bug.js (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2022-01-28Update README.mdGravatar Jarred Sumner 1-8/+5
2022-01-28Update README.mdGravatar Jarred Sumner 1-30/+48
2022-01-28Update README.mdGravatar Jarred Sumner 1-2/+2
2022-01-28Update README.mdGravatar Jarred Sumner 1-0/+5
2022-01-28Add Bun.Transpiler doc to the readmeGravatar Jarred Sumner 1-0/+215
2022-01-27Automate clang version checking / code signing (#113)Gravatar Alexander Kuznetsov 1-2/+14
2022-01-27Stop reading `"bun"` from package.jsonGravatar Jarred Sumner 1-29/+0
2022-01-27[bunfig] Implement config file formatGravatar Jarred Sumner 20-156/+667
2022-01-27Don't look like a crash when CLI args are missingGravatar Jarred Sumner 1-0/+3
2022-01-27[cli] Add support for commands which optionally have one argumentGravatar Jarred Sumner 3-12/+22
2022-01-26Update MakefileGravatar Jarred Sumner 1-1/+1
2022-01-26print file name on panicGravatar Jarred Sumner 1-1/+1
2022-01-25mergeGravatar Jarred Sumner 2-1/+2
2022-01-25Slightly saferGravatar Jarred Sumner 1-1/+1
2022-01-25Split http into filesGravatar Jarred Sumner 7-1079/+1055
2022-01-25Update DockerfileGravatar Jarred Sumner 1-1/+1
2022-01-25Fix up dev containerGravatar Jarred Sumner 2-5/+1
2022-01-25On successful connect, switch to non-blocking sockets until we're about to closeGravatar Jarred SUmner 1-2/+18
2022-01-25Fix getsockopt()Gravatar Jarred SUmner 1-2/+5
2022-01-24Automatically retry on would blockGravatar Jarred SUmner 1-8/+4
2022-01-24Fallback to readev / writevGravatar Jarred SUmner 1-7/+226
2022-01-24No io_uring for Ubuntu 20.04Gravatar Jarred SUmner 6-27/+50
2022-01-23Update io_linux.zigGravatar Jarred Sumner 1-0/+1
2022-01-23[linux][http] return errno instead of unexpectedGravatar Jarred Sumner 1-2/+31
2022-01-23[http] Remove usages of `unreachable` in syscall error handlingGravatar Jarred Sumner 1-10/+0
2022-01-23Update io_linux.zigGravatar Jarred Sumner 1-0/+1
2022-01-23Use non-cancellable syscalls for HTTP & use errno for errorsGravatar Jarred Sumner 3-78/+933
2022-01-23Improve error message when `bun upgrade` failsGravatar Jarred Sumner 1-1/+1
2022-01-23NiceGravatar Jarred Sumner 1-1/+1
2022-01-23Update analytics_thread.zigGravatar Jarred Sumner 1-0/+8