mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 02:48:59 +00:00
wip
This commit is contained in:
parent
134df290a3
commit
187516558a
@ -97,16 +97,21 @@ func (t *quicListener) serve(ctx context.Context) error {
|
||||
}
|
||||
defer func() { _ = udpConn.Close() }()
|
||||
|
||||
// XXX: HAX TO BE REVERTED
|
||||
// svc, conn := stun.New(t.cfg, t, udpConn)
|
||||
// defer conn.Close()
|
||||
// Wrap the UDP connection in a STUN service if STUN is enabled.
|
||||
var pktConn net.PacketConn
|
||||
if t.cfg.Options().IsStunDisabled() {
|
||||
pktConn = udpConn
|
||||
} else {
|
||||
svc, stunConn := stun.New(t.cfg, t, udpConn)
|
||||
defer stunConn.Close()
|
||||
go svc.Serve(ctx)
|
||||
pktConn = stunConn
|
||||
}
|
||||
|
||||
// go svc.Serve(ctx)
|
||||
t.registry.Register(t.uri.Scheme, pktConn)
|
||||
defer t.registry.Unregister(t.uri.Scheme, pktConn)
|
||||
|
||||
t.registry.Register(t.uri.Scheme, udpConn)
|
||||
defer t.registry.Unregister(t.uri.Scheme, udpConn)
|
||||
|
||||
listener, err := quic.Listen(udpConn, t.tlsCfg, quicConfig)
|
||||
listener, err := quic.Listen(pktConn, t.tlsCfg, quicConfig)
|
||||
if err != nil {
|
||||
l.Infoln("Listen (BEP/quic):", err)
|
||||
return err
|
||||
|
@ -21,8 +21,10 @@ import (
|
||||
|
||||
const stunRetryInterval = 5 * time.Minute
|
||||
|
||||
type Host = stun.Host
|
||||
type NATType = stun.NATType
|
||||
type (
|
||||
Host = stun.Host
|
||||
NATType = stun.NATType
|
||||
)
|
||||
|
||||
// NAT types.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user