This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEFORE: | |
PS C:\Users\ipc\tmp\tonic> D:\apps\ghz.exe --insecure --proto .\examples\proto\helloworld\helloworld.proto --call helloworld.Greeter.SayHello -d '{\"name\":\"Joe\"}' -n 100000 --connections=1 localhost:50051 | |
Summary: | |
Count: 100000 | |
Total: 3.89 s | |
Slowest: 13.00 ms | |
Fastest: 0 ns | |
Average: 1.87 ms | |
Requests/sec: 25674.03 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// So this code looks wrong to me. What the correct way to "switch" on ethertype to get the next layer? | |
let packet = // some bytes from a PCAP file | |
let ether = EthernetPacket::new(&packet).expect("could not parse Ethernet frame"); | |
// I don't know if the next line is valid; what if there's no Vlan layer and it doesn't parse ether.payload()? | |
let vlan = VlanPacket::new(ether.payload()).expect("could not parse Vlan frame"); | |
let payload = if ether.get_ethertype() == ethernet::EtherTypes::Vlan { | |
vlan.payload() | |
} else { | |
ether.payload() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// The request message containing the user's name. | |
#[derive(Clone, PartialEq, ::prost::Message)] | |
pub struct HelloRequest { | |
#[prost(string, tag="1")] | |
pub name: std::string::String, | |
} | |
/// The response message containing the greetings | |
#[derive(Clone, PartialEq, ::prost::Message)] | |
pub struct HelloReply { | |
#[prost(string, tag="1")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![deny(warnings, rust_2018_idioms)] | |
use futures::Future; | |
use hyper::client::connect::{Destination, HttpConnector}; | |
use tower_grpc::Request; | |
use tower_hyper::{client, util}; | |
use tower_util::MakeService; | |
use std::error::Error; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct GracefulTlsStream { | |
inner: Arc<Mutex<TlsStream<TcpStream, ClientSession>>>, | |
} | |
impl Write for GracefulTlsStream { | |
fn write(&mut self, buf: &[u8]) -> Result<usize, std::io::Error> { | |
let mut guard = self.inner.lock().unwrap(); | |
guard.write(buf) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate sxd_document; | |
extern crate sxd_xpath; | |
use std::error::Error; | |
use sxd_document::parser; | |
use sxd_xpath::evaluate_xpath; | |
use sxd_xpath::Value; | |
use sxd_document::dom::Document; | |
pub struct XmlFixDictionary<'a> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate actix_web; | |
extern crate slog_envlogger; | |
use actix_web::actix; | |
use actix_web::fs::NamedFile; | |
use actix_web::middleware; | |
use actix_web::HttpRequest; | |
use actix_web::Result; | |
use actix_web::{server, App}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Message)] | |
struct Batch { | |
key: String, | |
messages: Vec<String> | |
} | |
struct RedisListTailer { | |
redis: Addr<Redis>, | |
key: String, | |
current_index: isize, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c:\msys64\home\ipc\rust>rustup toolchain link latest-stage2 build\x86_64-pc-windows-gnu\stage2 | |
c:\msys64\home\ipc\rust>rustup default latest-stage2 | |
info: default toolchain set to 'latest-stage2' | |
c:\msys64\home\ipc\rust>rustup which rustc | |
C:\Users\ipc\.rustup\toolchains\latest-stage2\bin\rustc.exe | |
c:\msys64\home\ipc\rust>rustc -vV | |
rustc 1.29.0-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$win_user = "ipc" | |
$linux_user = "ipc" | |
$package = "CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc" | |
$base_path = "C:\Users\" + $win_user + "\AppData\Local\Packages\" + $package + "\LocalState\rootfs" | |
$dirs = @("\bin", "\sbin", "\usr\bin", "\usr\sbin", "\home\" + $linux_user + "\.cargo\bin") | |
$dirs | ForEach { Add-MpPreference -ExclusionProcess ($base_path + $_ + "\*") } | |
Add-MpPreference -ExclusionPath $base_path |
NewerOlder