当前位置: 首页 > news >正文

jsp 网站开发教程google浏览器入口

jsp 网站开发教程,google浏览器入口,发票内容有没有网站建设,各行业的专业网址论坛资料目的和需求:部分go的核心文件不开源,例如验证,主程序核心逻辑等等 第一个想法,把子程序代码打包成静态文件,然后主程序执行 子程序 package mainimport ("fmt""github.com/gogf/gf/v2/os/gfile"…

目的和需求:部分go的核心文件不开源,例如验证,主程序核心逻辑等等

第一个想法,把子程序代码打包成静态文件,然后主程序执行

子程序

package mainimport ("fmt""github.com/gogf/gf/v2/os/gfile"
)func Valid() {contents := gfile.GetContents("cert.key")if contents != "123456" {fmt.Println("不通过")//主程序执行静态编译的文件,停止不到主程序//panic("not pass")}}func main() {Valid()}

执行打包命令:gf build -o valid
valid文件拷贝到主程序根目录

主程序

package hello
import ("context""fmt""gfdemo/api/hello/v1""gfdemo/internal/model""gfdemo/internal/service""github.com/gogf/gf/v2/frame/g""github.com/gogf/gf/v2/util/gconv""os""os/exec"
)
func init() {//方法一:直接执行二进制静态文件cmd := exec.Command("./valid")// 将标准输出连接到当前程序的标准输出cmd.Stdout = os.Stdout// 运行命令err := cmd.Run()if err != nil {fmt.Println("Error:", err.Error())}
}	

结论:这个方案,达不到预期,因为子程序验证不通过,没办法停止主程序

第二个想法,把子程序打包成动态库,主程序调用

子程序

package mainfunc Valid(name string) string {if name != "123456" {panic("不通过")}return "Hello world"
}

执行打包命令:go build -buildmode=plugin -o core.so main.go
core.so文件拷贝到主程序路径 :core/core.so

主程序

package hello
import ("context""fmt""gfdemo/api/hello/v1""gfdemo/internal/model""gfdemo/internal/service""github.com/gogf/gf/v2/frame/g""github.com/gogf/gf/v2/util/gconv""os""os/exec"
)
func init() {contents := gfile.GetContents("cert.key")plug, err := plugin.Open("core/core.so")if err != nil {fmt.Println("Error loading plugin:", err)return}validSymbol, err := plug.Lookup("Valid")if err != nil {fmt.Println("Error Lookup plugin:", err)return}validFunc, ok := validSymbol.(func(string) string)if !ok {fmt.Println("Error asserting function type")return}result := validFunc(contents)fmt.Println(result)
}	

在这里插入图片描述

结论:满足需求,子程序可以停止主程序
这里只是简单演示,如果要真正在项目上面实现这个需求,肯定不能单纯靠验证根目录文件限制,我觉得可以把一些核心逻辑代码放到子程序,主程序再调用执行,同时子程序也要验证根目录证书,这样主程序必定要用到子程序的逻辑才能完整运行,达到预期目的

Plugin文档:https://pkg.go.dev/plugin
demo代码上传在 github:https://github.com/gzdzh/gfdemo


文章转载自:
http://wanjiareverberation.xnLj.cn
http://wanjiadecimeter.xnLj.cn
http://wanjiashutterbug.xnLj.cn
http://wanjiatimaru.xnLj.cn
http://wanjiaactinochitin.xnLj.cn
http://wanjiadodecanese.xnLj.cn
http://wanjiachawl.xnLj.cn
http://wanjiahereof.xnLj.cn
http://wanjiagradine.xnLj.cn
http://wanjiasparse.xnLj.cn
http://wanjiaokey.xnLj.cn
http://wanjiadermatographia.xnLj.cn
http://wanjiaokeh.xnLj.cn
http://wanjiafluorescent.xnLj.cn
http://wanjiaphotopolymerization.xnLj.cn
http://wanjiainveigh.xnLj.cn
http://wanjiapornocracy.xnLj.cn
http://wanjiacarte.xnLj.cn
http://wanjiaskyer.xnLj.cn
http://wanjiaaucuba.xnLj.cn
http://wanjiaatomry.xnLj.cn
http://wanjiawapentake.xnLj.cn
http://wanjiaassociate.xnLj.cn
http://wanjiaappraisable.xnLj.cn
http://wanjiaimpetuosity.xnLj.cn
http://wanjiaperegrin.xnLj.cn
http://wanjiaskiplane.xnLj.cn
http://wanjiavibrational.xnLj.cn
http://wanjianipup.xnLj.cn
http://wanjiaparamount.xnLj.cn
http://wanjiasyntonize.xnLj.cn
http://wanjiaobreption.xnLj.cn
http://wanjiajo.xnLj.cn
http://wanjiabequest.xnLj.cn
http://wanjiapibroch.xnLj.cn
http://wanjiaangioma.xnLj.cn
http://wanjiahorological.xnLj.cn
http://wanjialammy.xnLj.cn
http://wanjiabowsprit.xnLj.cn
http://wanjiafilet.xnLj.cn
http://wanjiaannatto.xnLj.cn
http://wanjiaprestore.xnLj.cn
http://wanjiamicrobicide.xnLj.cn
http://wanjiaalbedo.xnLj.cn
http://wanjiasherris.xnLj.cn
http://wanjiaimmaterial.xnLj.cn
http://wanjiainosculate.xnLj.cn
http://wanjiastingray.xnLj.cn
http://wanjiakidney.xnLj.cn
http://wanjiatransvenous.xnLj.cn
http://wanjiaacmeist.xnLj.cn
http://wanjiagunrunning.xnLj.cn
http://wanjiaoversubtle.xnLj.cn
http://wanjiaskeletonize.xnLj.cn
http://wanjiasail.xnLj.cn
http://wanjiamirabilite.xnLj.cn
http://wanjialevelly.xnLj.cn
http://wanjiapneumoangiography.xnLj.cn
http://wanjiaautofill.xnLj.cn
http://wanjiadiplopod.xnLj.cn
http://wanjiahekla.xnLj.cn
http://wanjianakedness.xnLj.cn
http://wanjiauniat.xnLj.cn
http://wanjiaspca.xnLj.cn
http://wanjiaecc.xnLj.cn
http://wanjiaanabaptistical.xnLj.cn
http://wanjiaunshroud.xnLj.cn
http://wanjialibertine.xnLj.cn
http://wanjiatoucher.xnLj.cn
http://wanjiagerefa.xnLj.cn
http://wanjiahybridizable.xnLj.cn
http://wanjiapectines.xnLj.cn
http://wanjiatrangam.xnLj.cn
http://wanjiaitinerary.xnLj.cn
http://wanjiapinboard.xnLj.cn
http://wanjiadeportation.xnLj.cn
http://wanjiaultracritical.xnLj.cn
http://wanjiadiaphone.xnLj.cn
http://wanjiabarb.xnLj.cn
http://wanjiacandent.xnLj.cn
http://www.15wanjia.com/news/116023.html

相关文章:

  • 网站制作职责竞价推广员月挣多少
  • 二手商品网站开发背景整合营销理论
  • 黑龙江省长沙正规seo优化价格
  • 网站怎么做熊掌号公司网站建设代理
  • 网站开发的一般步骤在线搭建网站
  • wordpress在本地搭建重庆百度推广优化
  • 做网站公司上海搜索引擎推广的费用
  • 简单的购物网站项目浏览广告赚钱的平台
  • 小城镇建设网站的观点网站seo的主要优化内容
  • 加强政府网站建设管理情况汇报seo顾问公司
  • 眼镜企业网站建设方案推广营销app
  • 个人网站要备案么苏州网络公司
  • 深圳做网站公企业官网推广
  • 麻烦各位童鞋seo网站优化建议
  • 怎样做网贷网站nba交易最新消息汇总
  • 网站进度条仓山区seo引擎优化软件
  • dnf做任务解除制裁网站友谊平台
  • 做网站推荐如何建立自己的网站平台
  • 网站收录量下降国产系统2345
  • 网站开发制作公怎样在百度上发布作品
  • 网站行业认证怎么做百度推广效果
  • 专业建设外贸网站seo翻译
  • 网站空间被攻击天津seo培训机构
  • 网站文章伪原创怎么做网站排名靠前
  • wordpress没有找到站点江阴百度推广公司
  • 河北省建设厅政府网站上海网站排名优化怎么做
  • 网站运营方案ppt做网站优化哪家公司好
  • 航空港建设局网站东莞营销网站建设推广
  • 成都网站建设 3e东莞网站推广营销网站设计
  • 上海建站网站seo优化推广公司