pion / stun

A Go implementation of STUN
https://pion.ly/
MIT License
601 stars 91 forks source link

nat-behaviour: fix filtering test #94

Closed Snawoot closed 2 years ago

Snawoot commented 2 years ago

Description

This PR fixes filtering tests of cmd/stun-nat-behaviour utility. Previously it reused STUN message structure and updated it with .Reset(). It causes message missing header and proper request type. Consequently, such messages were not recognized by stun servers and they did not respond. Lack of response was always considered to be an "address and port dependent filtering".

Instead of duplicating Message.Build() logic with .WriteHeader() and other internals, I've just reused common approach creating STUN message everywhere.

Sean-Der commented 2 years ago

Thank you so much @Snawoot !

codecov[bot] commented 2 years ago

Codecov Report

Merging #94 (cff1ac8) into master (592d9dc) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #94   +/-   ##
=======================================
  Coverage   98.17%   98.17%           
=======================================
  Files          20       20           
  Lines        1093     1093           
=======================================
  Hits         1073     1073           
  Misses         14       14           
  Partials        6        6           
Flag Coverage Δ
go 98.17% <ø> (ø)
wasm 55.33% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 592d9dc...cff1ac8. Read the comment docs.