Adopt absl::string_view in p2p/

Bug: webrtc:13579
Change-Id: Ia33afa2a9ad12d1a586087d49f581a93fddb565d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262766
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37381}
This commit is contained in:
Ali Tofigh
2022-06-30 11:58:26 +02:00
committed by WebRTC LUCI CQ
parent 4b97928b30
commit de2ac5a6f3
44 changed files with 353 additions and 319 deletions

View File

@ -800,6 +800,7 @@ if (is_linux || is_chromeos || is_win) {
"../rtc_base:socket_address",
"../rtc_base:socket_server",
"../rtc_base:threading",
"//third_party/abseil-cpp/absl/strings:strings",
]
}
rtc_executable("stunserver") {

View File

@ -14,6 +14,7 @@
#include <string>
#include <utility>
#include "absl/strings/string_view.h"
#include "examples/turnserver/read_auth_file.h"
#include "p2p/base/basic_packet_socket_factory.h"
#include "p2p/base/port_interface.h"
@ -32,12 +33,12 @@ class TurnFileAuth : public cricket::TurnAuthInterface {
explicit TurnFileAuth(std::map<std::string, std::string> name_to_key)
: name_to_key_(std::move(name_to_key)) {}
virtual bool GetKey(const std::string& username,
const std::string& realm,
virtual bool GetKey(absl::string_view username,
absl::string_view realm,
std::string* key) {
// File is stored as lines of <username>=<HA1>.
// Generate HA1 via "echo -n "<username>:<realm>:<password>" | md5sum"
auto it = name_to_key_.find(username);
auto it = name_to_key_.find(std::string(username));
if (it == name_to_key_.end())
return false;
*key = it->second;