1、sekiro服务端部署

项目地址:yint-tech/sekiro-open: SEKIRO是一个多语言的、分布式、网络拓扑无关的服务发布平台,通过书写各自语言的handler将功能发布到中心API市场,业务系统通过RPC的方式使用远端节点的能力 (github.com)https://github.com/yint-tech/sekiro-open文档地址:

服务器部署 · Sekiro系统文档 (iinti.cn)http://sekiro.iinti.cn/sekiro-doc/02_server/1.busniess_server.html所用环境是Ubuntu20

安装步骤:

1、安装docker

我参照的是这个文档

(48条消息) Ubuntu安装 Docker_胡八一 的博客-CSDN博客_ubuntu安装dockerhttps://blog.csdn.net/qq_44732146/article/details/121207737

2、安装docker-compose

sudo pip install docker-compose

3、安装sekiro

启动docker之后,执行如下命令,如果失败,可以直接执行下面的quickstart.sh文件

curl https://oss.iinti.cn/sekiro/quickstart.sh | bash

或者直接执行下面这个quickstart.sh

#!/usr/bin/env bash
now_dir=`pwd`if [ ! -d sekiro_compose ]; thenmkdir "sekiro_compose"
elserm -rf sekiro_compose/*
ficd sekiro_composecurl -o "sekiro_compose.zip" "https://oss.iinti.cn/sekiro/sekiro-compose.zip"(unzip --help) </dev/null >/dev/null 2>&1 || {echoecho "no unzip cmd , please install unzip first: yum install -y unzip"exit 4
}unzip sekiro_compose.zipsudo docker-compose down;sudo docker pull registry.cn-beijing.aliyuncs.com/iinti/common:sekiro3server-latestsudo docker-compose up -d

如下图:

打开网址http://服务器的IP:5612

注册账号,第一个注册账号是超级管理员

4、接下来,尝试过几种不同的方法让客户端和服务器连接上

下面的截图是官方的教程

(1)构造子域名的方法

在服务器的/etc/hosts文件里面配置如下

127.0.0.1   sekiro.licdn.com   (后面的这个域名是自己随便起的)

现在浏览器打开 http://sekiro.licdn.com:5612 看看是不是能正常打开进去网站,用刚刚注册的账号密码进行登录,这个带域名的网站和刚刚的网站是同一个网站。

下一步安装CA证书,官网有提供证书,直接下载。我下载的是pem格式的证书。

SSL证书方案 · Sekiro系统文档http://sekiro.iinti.cn/sekiro-doc/01_user_manual/6.sslForWebsocket.htmlUbuntu命令行安装证书,直接搜索网上的,可以使用。

过程图

现在浏览器打开 https://sekiro.licdn.com:5612 看看是不是能正常打开进去网站,注意http修改成了https,我到这一步的时候,还是会报不安全,截图如下:

安装证书还是提示Warning: Potential Security Risk Ahead,后来我在浏览器上调整了浏览器安全证书的容忍度,也是网上搜的,好像调整一下就好了,具体记不清楚了,大家可以试一下。

接下来注入js代码,并建立wss连接,复制官方的代码:

如下并做局部修改,将下面的wss://www.linkedin.cn/business/register?group=ws-group&clientId=修改为wss://sekiro.licdn.com:5612/business/register?group=ws-group&clientId=

function SekiroClient(e){if(this.wsURL=e,this.handlers={},this.socket={},!e)throw new Error("wsURL can not be empty!!");this.webSocketFactory=this.resolveWebSocketFactory(),this.connect()}SekiroClient.prototype.resolveWebSocketFactory=function(){if("object"==typeof window){var e=window.WebSocket?window.WebSocket:window.MozWebSocket;return function(o){function t(o){this.mSocket=new e(o)}return t.prototype.close=function(){this.mSocket.close()},t.prototype.onmessage=function(e){this.mSocket.onmessage=e},t.prototype.onopen=function(e){this.mSocket.onopen=e},t.prototype.onclose=function(e){this.mSocket.onclose=e},t.prototype.send=function(e){this.mSocket.send(e)},new t(o)}}if("object"==typeof weex)try{console.log("test webSocket for weex");var o=weex.requireModule("webSocket");return console.log("find webSocket for weex:"+o),function(e){try{o.close()}catch(t){}return o.WebSocket(e,""),o}}catch(t){console.log(t)}if("object"==typeof WebSocket)return function(o){return new e(o)};throw new Error("the js environment do not support websocket")},SekiroClient.prototype.connect=function(){console.log("sekiro: begin of connect to wsURL: "+this.wsURL);var e=this;try{this.socket=this.webSocketFactory(this.wsURL)}catch(o){console.log("sekiro: create connection failed,reconnect after 2s"),setTimeout(function(){e.connect()},2e3)}this.socket.onmessage(function(o){e.handleSekiroRequest(o.data)}),this.socket.onopen(function(e){console.log("sekiro: open a sekiro client connection")}),this.socket.onclose(function(o){console.log("sekiro: disconnected ,reconnection after 2s"),setTimeout(function(){e.connect()},2e3)})},SekiroClient.prototype.handleSekiroRequest=function(e){console.log("receive sekiro request: "+e);var o=JSON.parse(e),t=o.__sekiro_seq__;if(!o.action)return void this.sendFailed(t,"need request param {action}");var n=o.action;if(!this.handlers[n])return void this.sendFailed(t,"no action handler: "+n+" defined");var s=this.handlers[n],i=this;try{s(o,function(e){try{i.sendSuccess(t,e)}catch(o){i.sendFailed(t,"e:"+o)}},function(e){i.sendFailed(t,e)})}catch(r){console.log("error: "+r),i.sendFailed(t,":"+r)}},SekiroClient.prototype.sendSuccess=function(e,o){var t;if("string"==typeof o)try{t=JSON.parse(o)}catch(n){t={},t.data=o}else"object"==typeof o?t=o:(t={},t.data=o);(Array.isArray(t)||"string"==typeof t)&&(t={data:t,code:0}),t.code?t.code=0:t.status?t.status=0:t.status=0,t.__sekiro_seq__=e;var s=JSON.stringify(t);console.log("response :"+s),this.socket.send(s)},SekiroClient.prototype.sendFailed=function(e,o){"string"!=typeof o&&(o=JSON.stringify(o));var t={};t.message=o,t.status=-1,t.__sekiro_seq__=e;var n=JSON.stringify(t);console.log("sekiro: response :"+n),this.socket.send(n)},SekiroClient.prototype.registerAction=function(e,o){if("string"!=typeof e)throw new Error("an action must be string");if("function"!=typeof o)throw new Error("a handler must be function");return console.log("sekiro: register action: "+e),this.handlers[e]=o,this};var client = new SekiroClient("wss://www.linkedin.cn/business/register?group=ws-group&clientId=" + Math.random());
client.registerAction("testAction", function (request, resolve, reject) {c = undefined;resolve(window.ja("d_incareer2_profile_homepage", c));
});

回车如下:

但是好景不长呀,后面没多久就出问题了,如下:

在其他HTTPS网站是可以用的,但是到这个网站就不行,可能是这个网站的安全等级比较高,可能是证书问题嘛?也不太清楚 , 后来我访问https://sekiro.licdn.com:5612/时,发现还是不安全的。

当天这个问题没有解决,第二天了,继续。

更新一下docker

给浏览器设置代理到127.0.0.1 5612,这样浏览器访问就会经过sekiro服务器

重新将上面的wss连接进行修改如下:

var client = new SekiroClient("wss://www.linkedin.cn/business/register?group=ws-group&clientId=xxxxx");这样wss建立连接的时候,访问www.linkedin.cn就会走到sekiro服务器上

浏览器调用接口

测试成功!!!!

(2)sekiro和浏览器不在同一台电脑

sekiro启动成功之后,wss从客户端和服务端建立连接的时候,连接可以写域名或者服务器的ip地址,如var client = new SekiroClient("wss://192.168.126.131:5612/business/register?group=ws-group&clientId=xxxxx");或者var client = new SekiroClient("wss://sekiro.licdn.com:5612//business/register?group=ws-group&clientId=xxxxx");要保证的是电脑得配置hosts

这样就可以通过RPC远程调用JS函数,拿到数据,进行访问请求。

初次接触,写的不对的地方,请大家见谅,部分图片来源网络,如有请权,立即删除。

js_RPC,sekiro框架,实现HTTPS通讯相关推荐

  1. android视频缓存框架 [AndroidVideoCache](https://github.com/danikula/AndroidVideoCache) 源码解析与评估

    文章目录 android视频缓存框架 [AndroidVideoCache](https://github.com/danikula/AndroidVideoCache) 源码解析与评估 引言 使用方 ...

  2. play框架配置 拦截器_如何使用Play框架为https配置SSL证书

    play框架配置 拦截器 我花了几个小时试图使它起作用,最后,问题是我自己没有使用keytool生成CSR(证书请求). 当我尝试通过https访问Play时,我一直收到此错误: javax.net. ...

  3. 如何使用Play框架为https配置SSL证书

    我花了数小时试图使它起作用,最后,问题是我自己没有使用keytool生成CSR(证书请求). 尝试通过https访问Play时,我一直收到此错误: javax.net.ssl.SSLPeerUnver ...

  4. c#中https通讯如何添加证书

    c#如何在https在通讯中需要添加证书密码 public static class HTTPS{// byte[] certificate = Properties.Resources.client ...

  5. Android客户端与Java tomcat之间HTTPS通讯

    文中涉及到https认证和post传参. 不使用SSL(Secure Sockets Layer)/TLS的HTTP通信就是不加密的通信,所有信息都已明文传播,容易被窃取.篡改或冒充.SSL/TLS协 ...

  6. Win64 驱动内核编程-2.基本框架(安装.通讯.HelloWorld)

    驱动安装,通讯,Hello World 开发驱动的简单流程是这样,开发驱动安装程序,开发驱动程序,然后安装程序(或者其他程序)通过通讯给驱动传命令,驱动接到之后进行解析并且执行,然后把执行结果返回. ...

  7. java https通讯_Kubernetes - HTTPS在服务之间进行通信

    我在多个名称中运行的服务很少 . 我的部署如下 . Ingress - >服务(ClusterIP) - > Pods 我的应用程序作为HTTPS运行,因为一些限制和入口也作为HTTPS运 ...

  8. 网络请求框架 -- 理解Https

    一.前言 学习过计算机网络的都知道对于计算机网络的系统结构,如果以五层协议为标准可以将整个体系划分为五层,即物理层,数据链路层,网络层,运输层和最后的应用层,应用层的任务是通过应用进程间的交互来完成特 ...

  9. GoEasy,适用于多种前端框架,即时通讯技术

    //GoEasy官网:https://www.goeasy.io/ //别整那么多花里胡哨,直接复制粘贴下边代码就可以使用 //但是首先你要注意一下下边的代码 //注意点1:需要把appkey 替换成 ...

最新文章

  1. java web入门——概念理解、名词解释
  2. 2021-04-05 Python tqdm显示代码任务进度
  3. 开放平台战略下的趣店用户“跨界”
  4. 大数据:Parquet文件存储格式
  5. [2020-09-11 CQBZ/HSZX多校联测 T2] 泰拳警告(组合数+数学期望)
  6. 探索适用于Apache Spark的Spline Data Tracker和可视化工具(第2部分)
  7. vue-router 路由嵌套显示不出来_45. Vue路由vuerouter的基本使用
  8. gcc及doxygen的安装过程
  9. STM32工作笔记0055---认识pcbdoc文件Schdoc文件
  10. useradd - 帐 号 建 立 或 更 新 新 使 用 者 的 资 讯
  11. Ruby语法解释:attr_reader,attr_writer和attr_accessor
  12. 运动世界校园显示服务器异常,运动世界校园为什么成绩异常 成绩异常相关
  13. 互联网日报 | 字节跳动发布独立教育品牌“大力教育”;哈啰出行试水网约车;京东“好房京选”线下品牌落地...
  14. 教授专栏01 | 汪扬:元宇宙助香港,新经济创未来
  15. stm32怎么加载字库_如何用STM32的片内Flash存储中文字库
  16. vs2010打开需要安装 service pack1
  17. ZOJ4105 Abbreviation
  18. 论文项目复现笔记----Emotion Driven Monocular Face Capture and Animation
  19. 拿什么拯救你,“闯祸”的充电宝
  20. openwrt 防火墙

热门文章

  1. tensorflow源码精读之graph
  2. 【论文写作】Word中公式快捷输入方式
  3. 少侠学代码系列(一)-JS起源
  4. vue 页面回跳两个界面(返回上一页两次)
  5. 【Python文本处理】基于运动路线记录GPX的文件解析,及对经纬度坐标的数学模型运动速度求解
  6. 软件更新|增值税发票税控开票软件(金税盘版_V2.051ZS_20221031)
  7. 华科计算机电路理论实验报告,华中科技大学组成原理实验报告单周期MIPS CPU数据表示实验.docx...
  8. Java打印输出:在线天堂
  9. 河北省职称计算机考试什么时候,河北省2010年职称计算机考试报名时间通知
  10. mongodb一次性更新多条数据updateMany