mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
dns: update cache when an item expired
This commit is contained in:
1 parent
6d64ee4c0e
commit
6eda2b79c8
10 files changed
+80
-78
No files matched your search
@@ -125,7 +125,7 @@ func getOrigDst(c *net.TCPConn, ipv6 bool) (*net.TCPAddr, error) {
|
||||
var addr *net.TCPAddr
|
||||
rc.Control(func(fd uintptr) {
|
||||
if ipv6 {
|
||||
addr, err = ipv6_getorigdst(fd)
|
||||
addr, err = getorigdstIPv6(fd)
|
||||
} else {
|
||||
addr, err = getorigdst(fd)
|
||||
}
|
||||
@@ -150,7 +150,7 @@ func getorigdst(fd uintptr) (*net.TCPAddr, error) {
|
||||
|
||||
// Call ipv6_getorigdst() from linux/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
|
||||
// NOTE: I haven't tried yet but it should work since Linux 3.8.
|
||||
func ipv6_getorigdst(fd uintptr) (*net.TCPAddr, error) {
|
||||
func getorigdstIPv6(fd uintptr) (*net.TCPAddr, error) {
|
||||
const _IP6T_SO_ORIGINAL_DST = 80 // from linux/include/uapi/linux/netfilter_ipv6/ip6_tables.h
|
||||
var raw syscall.RawSockaddrInet6
|
||||
siz := unsafe.Sizeof(raw)
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// https://github.com/golang/go/blob/9e6b79a5dfb2f6fe4301ced956419a0da83bd025/src/syscall/syscall_linux_386.go#L196
|
||||
const GETSOCKOPT = 15 // https://golang.org/src/syscall/syscall_linux_386.go#L183
|
||||
|
||||
func socketcall(call, a0, a1, a2, a3, a4, a5 uintptr) error {
|
||||
|
||||
@@ -4,6 +4,7 @@ package redir
|
||||
|
||||
import "syscall"
|
||||
|
||||
// GETSOCKOPT from syscall
|
||||
const GETSOCKOPT = syscall.SYS_GETSOCKOPT
|
||||
|
||||
func socketcall(call, a0, a1, a2, a3, a4, a5 uintptr) error {
|
||||
|
||||
Reference in new issue
Block a user