Unwrap 4in6 address received by client packet conn

This commit is contained in:
世界 2023-06-19 13:29:41 +08:00
parent 702d96a738
commit cc7b5d8280
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
3 changed files with 13 additions and 13 deletions

8
go.mod
View file

@ -25,14 +25,14 @@ require (
github.com/sagernet/gvisor v0.0.0-20230611140528-4411f7659a08 github.com/sagernet/gvisor v0.0.0-20230611140528-4411f7659a08
github.com/sagernet/quic-go v0.0.0-20230615020047-10f05c797c02 github.com/sagernet/quic-go v0.0.0-20230615020047-10f05c797c02
github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691
github.com/sagernet/sing v0.2.5 github.com/sagernet/sing v0.2.6
github.com/sagernet/sing-dns v0.1.5 github.com/sagernet/sing-dns v0.1.5
github.com/sagernet/sing-mux v0.1.0 github.com/sagernet/sing-mux v0.1.0
github.com/sagernet/sing-shadowsocks v0.2.2 github.com/sagernet/sing-shadowsocks v0.2.2
github.com/sagernet/sing-shadowsocks2 v0.1.0 github.com/sagernet/sing-shadowsocks2 v0.1.1
github.com/sagernet/sing-shadowtls v0.1.2 github.com/sagernet/sing-shadowtls v0.1.2
github.com/sagernet/sing-tun v0.1.5 github.com/sagernet/sing-tun v0.1.6-0.20230619052205-bb60e4d6d06b
github.com/sagernet/sing-vmess v0.1.5 github.com/sagernet/sing-vmess v0.1.6
github.com/sagernet/smux v0.0.0-20230312102458-337ec2a5af37 github.com/sagernet/smux v0.0.0-20230312102458-337ec2a5af37
github.com/sagernet/tfo-go v0.0.0-20230303015439-ffcfd8c41cf9 github.com/sagernet/tfo-go v0.0.0-20230303015439-ffcfd8c41cf9
github.com/sagernet/utls v0.0.0-20230309024959-6732c2ab36f2 github.com/sagernet/utls v0.0.0-20230309024959-6732c2ab36f2

16
go.sum
View file

@ -116,22 +116,22 @@ github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 h1:5Th31OC6yj8byL
github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691/go.mod h1:B8lp4WkQ1PwNnrVMM6KyuFR20pU8jYBD+A4EhJovEXU= github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691/go.mod h1:B8lp4WkQ1PwNnrVMM6KyuFR20pU8jYBD+A4EhJovEXU=
github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY= github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY=
github.com/sagernet/sing v0.1.8/go.mod h1:jt1w2u7lJQFFSGLiRrRIs5YWmx4kAPfWuOejuDW9qMk= github.com/sagernet/sing v0.1.8/go.mod h1:jt1w2u7lJQFFSGLiRrRIs5YWmx4kAPfWuOejuDW9qMk=
github.com/sagernet/sing v0.2.5 h1:N8sUluR8GZvR9DqUiH3FA3vBb4m/EDdOVTYUrDzJvmY= github.com/sagernet/sing v0.2.6 h1:Fvqv7/Bwc72ERT6dE8yQLLY6SMc/syO3VMCtxVO4DNw=
github.com/sagernet/sing v0.2.5/go.mod h1:Ta8nHnDLAwqySzKhGoKk4ZIB+vJ3GTKj7UPrWYvM+4w= github.com/sagernet/sing v0.2.6/go.mod h1:Ta8nHnDLAwqySzKhGoKk4ZIB+vJ3GTKj7UPrWYvM+4w=
github.com/sagernet/sing-dns v0.1.5 h1:0J9G3ye+FUPUjIQXoWVF/RN3Ii4LtepbMmDL4SzEEh0= github.com/sagernet/sing-dns v0.1.5 h1:0J9G3ye+FUPUjIQXoWVF/RN3Ii4LtepbMmDL4SzEEh0=
github.com/sagernet/sing-dns v0.1.5/go.mod h1:4Wr7+I8H+i/fvjPQo5wyylhcM0GbNLiqevXmzOm0bHM= github.com/sagernet/sing-dns v0.1.5/go.mod h1:4Wr7+I8H+i/fvjPQo5wyylhcM0GbNLiqevXmzOm0bHM=
github.com/sagernet/sing-mux v0.1.0 h1:xihlDRNs1J+hYwmvW9/ZmaghjDx7O0Y5dty0pOLQGB4= github.com/sagernet/sing-mux v0.1.0 h1:xihlDRNs1J+hYwmvW9/ZmaghjDx7O0Y5dty0pOLQGB4=
github.com/sagernet/sing-mux v0.1.0/go.mod h1:i3jKjV4pRTFTV/ly5V3oa2JMPy0SAZ5X8X4tDU9Hw94= github.com/sagernet/sing-mux v0.1.0/go.mod h1:i3jKjV4pRTFTV/ly5V3oa2JMPy0SAZ5X8X4tDU9Hw94=
github.com/sagernet/sing-shadowsocks v0.2.2 h1:ezSdVhrmIcwDXmCZF3bOJVMuVtTQWpda+1Op+Ie2TA4= github.com/sagernet/sing-shadowsocks v0.2.2 h1:ezSdVhrmIcwDXmCZF3bOJVMuVtTQWpda+1Op+Ie2TA4=
github.com/sagernet/sing-shadowsocks v0.2.2/go.mod h1:JIBWG6a7orB2HxBxYElViQFLUQxFVG7DuqIj8gD7uCQ= github.com/sagernet/sing-shadowsocks v0.2.2/go.mod h1:JIBWG6a7orB2HxBxYElViQFLUQxFVG7DuqIj8gD7uCQ=
github.com/sagernet/sing-shadowsocks2 v0.1.0 h1:yXiAmSGQfYgdtSfpeA5ovc+qISBc865vmNCJPSlK7AM= github.com/sagernet/sing-shadowsocks2 v0.1.1 h1:/cZteeSFXyHKg0uOparIFNj8hHrV8F2rRzTm8arpBTs=
github.com/sagernet/sing-shadowsocks2 v0.1.0/go.mod h1:yD/LryoAhW1pYSHXjeITnggEeDwkOM5emmDAjHL6orU= github.com/sagernet/sing-shadowsocks2 v0.1.1/go.mod h1:p18C731ogLED66ZgC1SNYMOXAOxJIRwcTSUk73q/rsc=
github.com/sagernet/sing-shadowtls v0.1.2 h1:wkPf4gF+cmaP0cIbArpyq+mc6GcwbMx60CssmmhEQ0s= github.com/sagernet/sing-shadowtls v0.1.2 h1:wkPf4gF+cmaP0cIbArpyq+mc6GcwbMx60CssmmhEQ0s=
github.com/sagernet/sing-shadowtls v0.1.2/go.mod h1:rTxhbSY8jGWZOWjdeOe1vP3E+hkgen8aRA2p7YccM88= github.com/sagernet/sing-shadowtls v0.1.2/go.mod h1:rTxhbSY8jGWZOWjdeOe1vP3E+hkgen8aRA2p7YccM88=
github.com/sagernet/sing-tun v0.1.5 h1:sqIutzJBfxFeBfaIWu75AA4q/094CSdzgiGQfrwagW8= github.com/sagernet/sing-tun v0.1.6-0.20230619052205-bb60e4d6d06b h1:q8qr0SARPRoPyQfrAUQ6OKQXcQ0OK6zfC4anQ3eMXK8=
github.com/sagernet/sing-tun v0.1.5/go.mod h1:7nDIrea8A4ekY8cW6wbjM+sWHkzBQ/oFVmChlW/USOc= github.com/sagernet/sing-tun v0.1.6-0.20230619052205-bb60e4d6d06b/go.mod h1:7nDIrea8A4ekY8cW6wbjM+sWHkzBQ/oFVmChlW/USOc=
github.com/sagernet/sing-vmess v0.1.5 h1:5jECfTV9ma8wjNt/siZElKpKe3AjWmhi7NeLLfLzehY= github.com/sagernet/sing-vmess v0.1.6 h1:u9VhPNMP0u1vaEjWRWitJQ4KKYPhTF0rorpAlQZcFBg=
github.com/sagernet/sing-vmess v0.1.5/go.mod h1:d+TCQZgba0EM7+bRrp2pYn6wB0Kd3i+wHuD3M6IxvEQ= github.com/sagernet/sing-vmess v0.1.6/go.mod h1:XYXpk405G+kxRMNfREhROJsBxh1ccHy1v/fWSV5lx38=
github.com/sagernet/smux v0.0.0-20230312102458-337ec2a5af37 h1:HuE6xSwco/Xed8ajZ+coeYLmioq0Qp1/Z2zczFaV8as= github.com/sagernet/smux v0.0.0-20230312102458-337ec2a5af37 h1:HuE6xSwco/Xed8ajZ+coeYLmioq0Qp1/Z2zczFaV8as=
github.com/sagernet/smux v0.0.0-20230312102458-337ec2a5af37/go.mod h1:3skNSftZDJWTGVtVaM2jfbce8qHnmH/AGDRe62iNOg0= github.com/sagernet/smux v0.0.0-20230312102458-337ec2a5af37/go.mod h1:3skNSftZDJWTGVtVaM2jfbce8qHnmH/AGDRe62iNOg0=
github.com/sagernet/tfo-go v0.0.0-20230303015439-ffcfd8c41cf9 h1:2ItpW1nMNkPzmBTxV0/eClCklHrFSQMnUGcpUmJxVeE= github.com/sagernet/tfo-go v0.0.0-20230303015439-ffcfd8c41cf9 h1:2ItpW1nMNkPzmBTxV0/eClCklHrFSQMnUGcpUmJxVeE=

View file

@ -309,7 +309,7 @@ func ReadPacket(conn net.Conn, buffer *buf.Buffer) (M.Socksaddr, error) {
} }
_, err = buffer.ReadFullFrom(conn, int(length)) _, err = buffer.ReadFullFrom(conn, int(length))
return destination, err return destination.Unwrap(), err
} }
func WritePacket(conn net.Conn, buffer *buf.Buffer, destination M.Socksaddr) error { func WritePacket(conn net.Conn, buffer *buf.Buffer, destination M.Socksaddr) error {