Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
gost
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
gost
Commits
27dec2d2
Commit
27dec2d2
authored
Nov 23, 2021
by
sleshep
Committed by
ginuerzh
Nov 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: ugprade quic-go==v0.24.0
parent
8f08304b
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
256 additions
and
42 deletions
+256
-42
go.mod
go.mod
+3
-8
go.sum
go.sum
+223
-18
quic.go
quic.go
+30
-16
No files found.
go.mod
View file @
27dec2d2
...
@@ -8,8 +8,6 @@ require (
...
@@ -8,8 +8,6 @@ require (
github.com/LiamHaworth/go-tproxy v0.0.0-20190726054950-ef7efd7f24ed
github.com/LiamHaworth/go-tproxy v0.0.0-20190726054950-ef7efd7f24ed
github.com/Yawning/chacha20 v0.0.0-20170904085104-e3b1f968fc63 // indirect
github.com/Yawning/chacha20 v0.0.0-20170904085104-e3b1f968fc63 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/bifurcation/mint v0.0.0-20181105071958-a14404e9a861 // indirect
github.com/cheekybits/genny v1.0.0 // indirect
github.com/coreos/go-iptables v0.5.0 // indirect
github.com/coreos/go-iptables v0.5.0 // indirect
github.com/docker/libcontainer v2.2.1+incompatible
github.com/docker/libcontainer v2.2.1+incompatible
github.com/ginuerzh/gosocks4 v0.0.1
github.com/ginuerzh/gosocks4 v0.0.1
...
@@ -20,12 +18,9 @@ require (
...
@@ -20,12 +18,9 @@ require (
github.com/gobwas/glob v0.2.3
github.com/gobwas/glob v0.2.3
github.com/google/gopacket v1.1.19 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/gorilla/websocket v1.4.2
github.com/gorilla/websocket v1.4.2
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/klauspost/compress v1.11.12
github.com/klauspost/compress v1.11.12
github.com/klauspost/reedsolomon v1.9.12 // indirect
github.com/klauspost/reedsolomon v1.9.12 // indirect
github.com/lucas-clemente/aes12 v0.0.0-20171027163421-cd47fb39b79f // indirect
github.com/lucas-clemente/quic-go v0.24.0
github.com/lucas-clemente/quic-go v0.10.0
github.com/lucas-clemente/quic-go-certificates v0.0.0-20160823095156-d2f86524cced // indirect
github.com/miekg/dns v1.1.41
github.com/miekg/dns v1.1.41
github.com/milosgajdos/tenus v0.0.3
github.com/milosgajdos/tenus v0.0.3
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
...
@@ -37,9 +32,9 @@ require (
...
@@ -37,9 +32,9 @@ require (
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect
github.com/tjfoc/gmsm v1.4.0 // indirect
github.com/tjfoc/gmsm v1.4.0 // indirect
github.com/xtaci/kcp-go v5.4.20+incompatible
github.com/xtaci/kcp-go v5.4.20+incompatible
github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37 // indirect
github.com/xtaci/smux v1.5.15
github.com/xtaci/smux v1.5.15
github.com/xtaci/tcpraw v1.2.25
github.com/xtaci/tcpraw v1.2.25
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781
golang.org/x/text v0.3.5 // indirect
)
)
go.sum
View file @
27dec2d2
This diff is collapsed.
Click to expand it.
quic.go
View file @
27dec2d2
package
gost
package
gost
import
(
import
(
"context"
"crypto/aes"
"crypto/aes"
"crypto/cipher"
"crypto/cipher"
"crypto/rand"
"crypto/rand"
...
@@ -21,7 +22,7 @@ type quicSession struct {
...
@@ -21,7 +22,7 @@ type quicSession struct {
}
}
func
(
session
*
quicSession
)
GetConn
()
(
*
quicConn
,
error
)
{
func
(
session
*
quicSession
)
GetConn
()
(
*
quicConn
,
error
)
{
stream
,
err
:=
session
.
session
.
OpenStreamSync
()
stream
,
err
:=
session
.
session
.
OpenStreamSync
(
context
.
Background
()
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -33,7 +34,7 @@ func (session *quicSession) GetConn() (*quicConn, error) {
...
@@ -33,7 +34,7 @@ func (session *quicSession) GetConn() (*quicConn, error) {
}
}
func
(
session
*
quicSession
)
Close
()
error
{
func
(
session
*
quicSession
)
Close
()
error
{
return
session
.
session
.
Close
(
)
return
session
.
session
.
Close
WithError
(
quic
.
ApplicationErrorCode
(
0
),
"closed"
)
}
}
type
quicTransporter
struct
{
type
quicTransporter
struct
{
...
@@ -139,15 +140,15 @@ func (tr *quicTransporter) initSession(addr string, conn net.Conn, config *QUICC
...
@@ -139,15 +140,15 @@ func (tr *quicTransporter) initSession(addr string, conn net.Conn, config *QUICC
return
nil
,
err
return
nil
,
err
}
}
quicConfig
:=
&
quic
.
Config
{
quicConfig
:=
&
quic
.
Config
{
HandshakeTimeout
:
config
.
Timeout
,
HandshakeIdleTimeout
:
config
.
Timeout
,
KeepAlive
:
config
.
KeepAlive
,
KeepAlive
:
config
.
KeepAlive
,
IdleTimeout
:
config
.
IdleTimeout
,
Versions
:
[]
quic
.
VersionNumber
{
Versions
:
[]
quic
.
VersionNumber
{
quic
.
Version
GQUIC43
,
quic
.
Version
1
,
quic
.
Version
GQUIC3
9
,
quic
.
Version
Draft2
9
,
},
},
MaxIdleTimeout
:
config
.
IdleTimeout
,
}
}
session
,
err
:=
quic
.
Dial
(
udpConn
,
udpAddr
,
addr
,
config
.
TLSConfig
,
quicConfig
)
session
,
err
:=
quic
.
Dial
(
udpConn
,
udpAddr
,
addr
,
tlsConfigQUICALPN
(
config
.
TLSConfig
)
,
quicConfig
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Logf
(
"quic dial %s: %v"
,
addr
,
err
)
log
.
Logf
(
"quic dial %s: %v"
,
addr
,
err
)
return
nil
,
err
return
nil
,
err
...
@@ -180,16 +181,19 @@ func QUICListener(addr string, config *QUICConfig) (Listener, error) {
...
@@ -180,16 +181,19 @@ func QUICListener(addr string, config *QUICConfig) (Listener, error) {
config
=
&
QUICConfig
{}
config
=
&
QUICConfig
{}
}
}
quicConfig
:=
&
quic
.
Config
{
quicConfig
:=
&
quic
.
Config
{
HandshakeTimeout
:
config
.
Timeout
,
HandshakeIdleTimeout
:
config
.
Timeout
,
KeepAlive
:
config
.
KeepAlive
,
KeepAlive
:
config
.
KeepAlive
,
IdleTimeout
:
config
.
IdleTimeout
,
MaxIdleTimeout
:
config
.
IdleTimeout
,
Versions
:
[]
quic
.
VersionNumber
{
quic
.
Version1
,
quic
.
VersionDraft29
,
},
}
}
tlsConfig
:=
config
.
TLSConfig
tlsConfig
:=
config
.
TLSConfig
if
tlsConfig
==
nil
{
if
tlsConfig
==
nil
{
tlsConfig
=
DefaultTLSConfig
tlsConfig
=
DefaultTLSConfig
}
}
var
conn
net
.
PacketConn
var
conn
net
.
PacketConn
udpAddr
,
err
:=
net
.
ResolveUDPAddr
(
"udp"
,
addr
)
udpAddr
,
err
:=
net
.
ResolveUDPAddr
(
"udp"
,
addr
)
...
@@ -206,7 +210,7 @@ func QUICListener(addr string, config *QUICConfig) (Listener, error) {
...
@@ -206,7 +210,7 @@ func QUICListener(addr string, config *QUICConfig) (Listener, error) {
conn
=
&
quicCipherConn
{
UDPConn
:
lconn
,
key
:
config
.
Key
}
conn
=
&
quicCipherConn
{
UDPConn
:
lconn
,
key
:
config
.
Key
}
}
}
ln
,
err
:=
quic
.
Listen
(
conn
,
tlsConfig
,
quicConfig
)
ln
,
err
:=
quic
.
Listen
(
conn
,
tlsConfig
QUICALPN
(
tlsConfig
)
,
quicConfig
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -223,7 +227,7 @@ func QUICListener(addr string, config *QUICConfig) (Listener, error) {
...
@@ -223,7 +227,7 @@ func QUICListener(addr string, config *QUICConfig) (Listener, error) {
func
(
l
*
quicListener
)
listenLoop
()
{
func
(
l
*
quicListener
)
listenLoop
()
{
for
{
for
{
session
,
err
:=
l
.
ln
.
Accept
()
session
,
err
:=
l
.
ln
.
Accept
(
context
.
Background
()
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Log
(
"[quic] accept:"
,
err
)
log
.
Log
(
"[quic] accept:"
,
err
)
l
.
errChan
<-
err
l
.
errChan
<-
err
...
@@ -239,10 +243,10 @@ func (l *quicListener) sessionLoop(session quic.Session) {
...
@@ -239,10 +243,10 @@ func (l *quicListener) sessionLoop(session quic.Session) {
defer
log
.
Logf
(
"[quic] %s >-< %s"
,
session
.
RemoteAddr
(),
session
.
LocalAddr
())
defer
log
.
Logf
(
"[quic] %s >-< %s"
,
session
.
RemoteAddr
(),
session
.
LocalAddr
())
for
{
for
{
stream
,
err
:=
session
.
AcceptStream
()
stream
,
err
:=
session
.
AcceptStream
(
context
.
Background
()
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Log
(
"[quic] accept stream:"
,
err
)
log
.
Log
(
"[quic] accept stream:"
,
err
)
session
.
Close
(
)
session
.
Close
WithError
(
quic
.
ApplicationErrorCode
(
0
),
"closed"
)
return
return
}
}
...
@@ -362,3 +366,13 @@ func (conn *quicCipherConn) decrypt(data []byte) ([]byte, error) {
...
@@ -362,3 +366,13 @@ func (conn *quicCipherConn) decrypt(data []byte) ([]byte, error) {
nonce
,
ciphertext
:=
data
[
:
nonceSize
],
data
[
nonceSize
:
]
nonce
,
ciphertext
:=
data
[
:
nonceSize
],
data
[
nonceSize
:
]
return
gcm
.
Open
(
nil
,
nonce
,
ciphertext
,
nil
)
return
gcm
.
Open
(
nil
,
nonce
,
ciphertext
,
nil
)
}
}
func
tlsConfigQUICALPN
(
tlsConfig
*
tls
.
Config
)
*
tls
.
Config
{
if
tlsConfig
==
nil
{
panic
(
"quic: tlsconfig is nil"
)
}
tlsConfigQUIC
:=
&
tls
.
Config
{}
*
tlsConfigQUIC
=
*
tlsConfig
tlsConfigQUIC
.
NextProtos
=
[]
string
{
"http/3"
,
"quic/v1"
}
return
tlsConfigQUIC
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment