chore(exhook): add more option for protobuff

This commit is contained in:
JianBo He 2021-02-28 15:36:34 +08:00
parent 0d8c137cb5
commit f9d5d3523d
2 changed files with 10 additions and 19 deletions

View File

@ -16,6 +16,12 @@
syntax = "proto3";
option csharp_namespace = "Emqx.Exhook.V1";
option go_package = "emqx.io/grpc/exhook";
option java_multiple_files = true;
option java_package = "io.emqx.exhook";
option java_outer_classname = "EmqxExHookProto";
package emqx.exhook.v1;
service HookProvider {

View File

@ -307,26 +307,11 @@ stringfy(Term) when is_atom(Term) ->
stringfy(Term) ->
unicode:characters_to_binary((io_lib:format("~0p", [Term]))).
hexstr(<<>>) -> [];
hexstr(<<H:4, L:4, B/binary>>) ->
iolist_to_binary([hexchar(H), hexchar(L)] ++ hexstr(B)).
hexstr(B) ->
<< <<(hexchar(H)), (hexchar(L))>> || <<H:4, L:4>> <= B>>.
hexchar(0) -> $0;
hexchar(1) -> $1;
hexchar(2) -> $2;
hexchar(3) -> $3;
hexchar(4) -> $4;
hexchar(5) -> $5;
hexchar(6) -> $6;
hexchar(7) -> $7;
hexchar(8) -> $8;
hexchar(9) -> $9;
hexchar(10) -> $A;
hexchar(11) -> $B;
hexchar(12) -> $C;
hexchar(13) -> $D;
hexchar(14) -> $E;
hexchar(15) -> $F.
hexchar(I) when I >= 0 andalso I < 10 -> I + $0;
hexchar(I) -> I - 10 + $A.
%%--------------------------------------------------------------------
%% Acc funcs