8 Commits
Author SHA1 Message Date
xtaci 8fd6d90d50 perf(test): reduce 1GB echo allocations and random overhead
- Reuse buffers and use rng.Read to cut per-iteration allocations in random echo test
- Separate RNG for payload length to keep data stream deterministic
- Optimize UDP source validation by comparing UDPAddr directly to avoid per-packet String allocation
2026-01-26 11:23:51 +08:00
xtaci 508806662a fix: initialize source address in readLoop from remote addr
Previously, the `readLoop` would lazily initialize the source address (`src`) based on the first incoming packet. This behavior meant that for a short window during initialization, the session might accept a packet from an arbitrary address, potentially allowing connection hijacking or address spoofing.

This change ensures that if `s.remote` is already known (e.g., in `Dial` mode), `src` is initialized immediately before entering the loop. This locks the session to the expected remote address from thefix: initialize source address in readLoop from remote addr

Previously, the `readLoop` would lazily initialize the source address (`src`) based on the first incoming packet. This behavior meant that for a short window during initialization, the session might accept a packet from an arbitrary address, potentially allowing connection hijacking or address spoofing.

This change ensures that if `s.remote` is already known (e.g., in `Dial` mode), `src` is initialized immediately before entering the loop. This locks the session to the expected remote address from the start.
2025-12-19 13:08:29 +08:00
Coia Prant 6504d5b9f9 readLoop 和 tx 优化 (#313)
* chores: use modern platform optimize

* refactor: readloop, tx

* chores: drop older linux compatibility

Go 1.24+ requires linux kernel 3.2
2025-12-09 15:04:29 +08:00
xtaci 56de076e83 Squashed commit of the following:
commit 745517fcc4
Author: xtaci <imap@live.com>
Date:   Fri Jun 6 11:13:27 2025 +0800

    fix grow

commit 1b6d34570a
Author: xtaci <imap@live.com>
Date:   Fri Jun 6 10:48:07 2025 +0800

    Squashed commit of the following:

    commit 8f90af5057
    Author: xtaci <imap@live.com>
    Date:   Fri Jun 6 10:46:52 2025 +0800

        add ForEach in ringbuffer

    commit 82250c1f06
    Author: xtaci <imap@live.com>
    Date:   Fri Jun 6 10:29:23 2025 +0800

        add test for grow()

    commit 174824b596
    Author: xtaci <imap@live.com>
    Date:   Fri Jun 6 10:08:05 2025 +0800

        remove fmt.Print

    commit 6534dfe542
    Author: xtaci <imap@live.com>
    Date:   Fri Jun 6 10:06:18 2025 +0800

        rename to ringbuffer

    commit 2f44ba9a82
    Author: xtaci <imap@live.com>
    Date:   Fri Jun 6 10:03:14 2025 +0800

        add comments

    commit 3f49975468
    Author: xtaci <imap@live.com>
    Date:   Fri Jun 6 10:02:14 2025 +0800

        save

    commit c505f434cc
    Author: xtaci <daniel820313@gmail.com>
    Date:   Thu Jun 5 17:47:17 2025 +0800

        add ring

commit 3b4daea2cd
Author: FULI <daniel820313@gmail.com>
Date:   Fri Jun 6 10:30:51 2025 +0800

    RingBuffer (#290)

    * add ring

    * save

    * add comments

    * rename to ringbuffer

    * remove fmt.Print

    * add test for grow()

commit e0169fb60e
Author: xtaci <imap@live.com>
Date:   Sun May 25 00:09:13 2025 +0800

    make fec.go more clear

commit 97d2673e8a
Author: xtaci <imap@live.com>
Date:   Wed May 21 13:55:08 2025 +0800

    add comments to fec.go

commit 5ef7e8042f
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue May 20 10:38:46 2025 +0800

    Bump golang.org/x/net from 0.36.0 to 0.38.0 (#287)

    Bumps [golang.org/x/net](https://github.com/golang/net) from 0.36.0 to 0.38.0.
    - [Commits](https://github.com/golang/net/compare/v0.36.0...v0.38.0)

    ---
    updated-dependencies:
    - dependency-name: golang.org/x/net
      dependency-version: 0.38.0
      dependency-type: direct:production
    ...

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit 11ae2d1c3e
Author: xtaci <imap@live.com>
Date:   Tue Apr 15 10:40:08 2025 +0800

    update go.mod

commit 53b48e42c2
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Apr 15 10:38:02 2025 +0800

    Bump golang.org/x/net from 0.23.0 to 0.36.0 (#286)

    Bumps [golang.org/x/net](https://github.com/golang/net) from 0.23.0 to 0.36.0.
    - [Commits](https://github.com/golang/net/compare/v0.23.0...v0.36.0)

    ---
    updated-dependencies:
    - dependency-name: golang.org/x/net
      dependency-version: 0.36.0
      dependency-type: direct:production
    ...

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit f327c26f53
Author: Roman Gurov <44749519+rgurov@users.noreply.github.com>
Date:   Fri Apr 11 05:11:14 2025 +0300

    fix: typo in README.md (#284)

commit c5078bd33b
Author: Roman Gurov <44749519+rgurov@users.noreply.github.com>
Date:   Wed Apr 9 10:44:14 2025 +0300

    fix: make timeout error implement net.Error (#283)

commit 3c579515d6
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Feb 18 14:33:01 2025 +0800

    Bump golang.org/x/crypto from 0.21.0 to 0.31.0 (#281)

    Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.21.0 to 0.31.0.
    - [Commits](https://github.com/golang/crypto/compare/v0.21.0...v0.31.0)

    ---
    updated-dependencies:
    - dependency-name: golang.org/x/crypto
      dependency-type: direct:production
    ...

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit 5c80bedd4b
Author: xiabin <snyh@snyh.org>
Date:   Fri Dec 27 13:08:22 2024 +0800

    fix: reading low-level net.PacketConn when UDPSession is closed (#280)
2025-06-06 11:18:40 +08:00
xtaci 3040333ea6 adjust comments 2024-07-27 21:54:02 +08:00
xtaci 3653cc9fea add license to source codes 2024-07-25 21:35:37 +08:00
xtaci 582575ef06 Squashed commit of the following:
commit a8ae293a9ddee042c35e2501f93fa5dfa2425302
Merge: bdaf81e 1a84985
Author: xtaci <daniel820313@gmail.com>
Date:   Fri Oct 9 22:48:13 2020 +0800

    Merge branch 'master' into autotune

commit bdaf81e88e
Author: xtaci <daniel820313@gmail.com>
Date:   Fri Oct 9 22:38:31 2020 +0800

    add loc

commit ce66a98f95
Author: xtaci <daniel820313@gmail.com>
Date:   Fri Oct 9 19:53:42 2020 +0800

    lint

commit ad7383d8a3
Author: xtaci <daniel820313@gmail.com>
Date:   Fri Oct 9 19:05:35 2020 +0800

    fix typo

commit dc0fc2364c
Author: xtaci <daniel820313@gmail.com>
Date:   Fri Oct 9 16:47:14 2020 +0800

    adjust tests

commit ec45b72c39
Author: xtaci <daniel820313@gmail.com>
Date:   Fri Oct 9 16:45:17 2020 +0800

    remove obsolete decoder in listener

commit 827aa70e29
Author: xtaci <daniel820313@gmail.com>
Date:   Fri Oct 9 16:42:42 2020 +0800

    use hierarchical defensive receiving strategy

commit f5ca6b0e3a
Author: xtaci <daniel820313@gmail.com>
Date:   Fri Oct 9 16:34:30 2020 +0800

    optimize condition

commit ff34f7683f
Author: xtaci <daniel820313@gmail.com>
Date:   Fri Oct 9 15:18:00 2020 +0800

    fix test

commit a08b274651
Author: xtaci <daniel820313@gmail.com>
Date:   Fri Oct 9 15:13:20 2020 +0800

    solve compability issue with non FEC sender

commit ab7596783b
Author: xtaci <daniel820313@gmail.com>
Date:   Fri Oct 9 15:02:34 2020 +0800

    implements autotune in fec decoder

commit 260f61b3eb
Author: xtaci <daniel820313@gmail.com>
Date:   Fri Oct 9 14:34:48 2020 +0800

    hack 16-bit to identify FEC from packet

commit 105bfec567
Author: xtaci <daniel820313@gmail.com>
Date:   Fri Oct 2 21:38:47 2020 +0800

    add autotune
2020-10-09 22:52:11 +08:00
xtaci 5e990bd411 safer conversion 2019-05-23 23:56:01 +08:00