浏览代码

Merge branch 'main' into main

PayneWu 3 年之前
父节点
当前提交
bfc8266eb2
共有 8 个文件被更改,包括 2325 次插入134 次删除
  1. 1049 0
      .dockerignore
  2. 1046 0
      .gitignore
  3. 21 0
      Deployments/Dockerfile
  4. 42 0
      Deployments/deployment.yml
  5. 10 0
      Deployments/docker-compose.yml
  6. 7 2
      README.md
  7. 67 49
      main.go
  8. 83 83
      resouces/JsEnv.js

+ 1049 - 0
.dockerignore

@@ -0,0 +1,1049 @@
+### MonoDevelop template
+#User Specific
+*.userprefs
+*.usertasks
+
+#Mono Project Files
+*.pidb
+*.resources
+test-results/
+
+### NotepadPP template
+# Notepad++ backups #
+*.bak
+
+### VisualStudioCode template
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+*.code-workspace
+
+# Local History for Visual Studio Code
+.history/
+
+### VirtualEnv template
+# Virtualenv
+# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
+.Python
+[Bb]in
+[Ii]nclude
+[Ll]ib
+[Ll]ib64
+[Ll]ocal
+[Ss]cripts
+pyvenv.cfg
+.venv
+pip-selfcheck.json
+
+### Diff template
+*.patch
+*.diff
+
+### Eclipse template
+.metadata
+bin/
+tmp/
+*.tmp
+*.swp
+*~.nib
+local.properties
+.settings/
+.loadpath
+.recommenders
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# PyDev specific (Python IDE for Eclipse)
+*.pydevproject
+
+# CDT-specific (C/C++ Development Tooling)
+.cproject
+
+# CDT- autotools
+.autotools
+
+# Java annotation processor (APT)
+.factorypath
+
+# PDT-specific (PHP Development Tools)
+.buildpath
+
+# sbteclipse plugin
+.target
+
+# Tern plugin
+.tern-project
+
+# TeXlipse plugin
+.texlipse
+
+# STS (Spring Tool Suite)
+.springBeans
+
+# Code Recommenders
+.recommenders/
+
+# Annotation Processing
+.apt_generated/
+.apt_generated_test/
+
+# Scala IDE specific (Scala & Java development for Eclipse)
+.cache-main
+.scala_dependencies
+.worksheet
+
+# Uncomment this line if you wish to ignore the project description file.
+# Typically, this file would be tracked if it contains build/dependency configurations:
+#.project
+
+### EiffelStudio template
+# The compilation directory
+EIFGENs
+
+### Go template
+# Binaries for programs and plugins
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Test binary, built with `go test -c`
+*.test
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
+
+# Dependency directories (remove the comment below to include it)
+# vendor/
+
+### Dreamweaver template
+# DW Dreamweaver added files
+_notes
+_compareTemp
+configs/
+dwsync.xml
+dw_php_codehinting.config
+*.mno
+
+### PuTTY template
+# Private key
+*.ppk
+
+### WebMethods template
+**/IntegrationServer/datastore/
+**/IntegrationServer/db/
+**/IntegrationServer/DocumentStore/
+**/IntegrationServer/lib/
+**/IntegrationServer/logs/
+**/IntegrationServer/replicate/
+**/IntegrationServer/sdk/
+**/IntegrationServer/support/
+**/IntegrationServer/update/
+**/IntegrationServer/userFtpRoot/
+**/IntegrationServer/web/
+**/IntegrationServer/WmRepository4/
+**/IntegrationServer/XAStore/
+**/IntegrationServer/packages/Wm*/
+
+### MATLAB template
+# Windows default autosave extension
+*.asv
+
+# OSX / *nix default autosave extension
+*.m~
+
+# Compiled MEX binaries (all platforms)
+*.mex*
+
+# Packaged app and toolbox files
+*.mlappinstall
+*.mltbx
+
+# Generated helpsearch folders
+helpsearch*/
+
+# Simulink code generation folders
+slprj/
+sccprj/
+
+# Matlab code generation folders
+codegen/
+
+# Simulink autosave extension
+*.autosave
+
+# Simulink cache files
+*.slxc
+
+# Octave session info
+octave-workspace
+
+### Vagrant template
+# General
+.vagrant/
+
+# Log files (if you are creating logs in debug mode, uncomment this)
+# *.log
+
+### MicrosoftOffice template
+
+# Word temporary
+~$*.doc*
+
+# Word Auto Backup File
+Backup of *.doc*
+
+# Excel temporary
+~$*.xls*
+
+# Excel Backup File
+*.xlk
+
+# PowerPoint temporary
+~$*.ppt*
+
+# Visio autosave temporary files
+*.~vsd*
+
+### JetBrains template
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+
+# Generated files
+.idea/**/contentModel.xml
+
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+
+# Gradle
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn.  Uncomment if using
+# auto-import.
+# .idea/artifacts
+# .idea/compiler.xml
+# .idea/jarRepositories.xml
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+# *.iml
+# *.ipr
+
+# CMake
+cmake-build-*/
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# File-based project format
+*.iws
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+# Android studio 3.1+ serialized cache file
+.idea/caches/build_file_checksums.ser
+
+### DartEditor template
+.project
+.buildlog
+
+### Ninja template
+.ninja_deps
+.ninja_log
+
+### Archives template
+# It's better to unpack these files and commit the raw source because
+# git has its own built in compression methods.
+*.7z
+*.jar
+*.rar
+*.zip
+*.gz
+*.gzip
+*.tgz
+*.bzip
+*.bzip2
+*.bz2
+*.xz
+*.lzma
+*.cab
+*.xar
+
+# Packing-only formats
+*.iso
+*.tar
+
+# Package management formats
+*.dmg
+*.xpi
+*.gem
+*.egg
+*.deb
+*.rpm
+*.msi
+*.msm
+*.msp
+*.txz
+
+### SynopsysVCS template
+# Waveform formats
+*.vcd
+*.vpd
+*.evcd
+*.fsdb
+
+# Default name of the simulation executable.  A different name can be
+# specified with this switch (the associated daidir database name is
+# also taken from here):  -o <path>/<filename>
+simv
+
+# Generated for Verilog and VHDL top configs
+simv.daidir/
+simv.db.dir/
+
+# Infrastructure necessary to co-simulate SystemC models with
+# Verilog/VHDL models.  An alternate directory may be specified with this
+# switch:  -Mdir=<directory_path>
+csrc/
+
+# Log file - the following switch allows to specify the file that will be
+# used to write all messages from simulation:  -l <filename>
+*.log
+
+# Coverage results (generated with urg) and database location.  The
+# following switch can also be used:  urg -dir <coverage_directory>.vdb
+simv.vdb/
+urgReport/
+
+# DVE and UCLI related files.
+DVEfiles/
+ucli.key
+
+# When the design is elaborated for DirectC, the following file is created
+# with declarations for C/C++ functions.
+vc_hdrs.h
+
+### Tags template
+# Ignore tags created by etags, ctags, gtags (GNU global) and cscope
+TAGS
+.TAGS
+!TAGS/
+tags
+.tags
+!tags/
+gtags.files
+GTAGS
+GRTAGS
+GPATH
+GSYMS
+cscope.files
+cscope.out
+cscope.in.out
+cscope.po.out
+
+
+### TortoiseGit template
+# Project-level settings
+/.tgitconfig
+
+### Momentics template
+# Built files
+x86/
+arm/
+arm-p/
+translations/*.qm
+
+# IDE settings
+
+### Images template
+# JPEG
+*.jpg
+*.jpeg
+*.jpe
+*.jif
+*.jfif
+*.jfi
+
+# JPEG 2000
+*.jp2
+*.j2k
+*.jpf
+*.jpx
+*.jpm
+*.mj2
+
+# JPEG XR
+*.jxr
+*.hdp
+*.wdp
+
+# Graphics Interchange Format
+*.gif
+
+# RAW
+*.raw
+
+# Web P
+*.webp
+
+# Portable Network Graphics
+*.png
+
+# Animated Portable Network Graphics
+*.apng
+
+# Multiple-image Network Graphics
+*.mng
+
+# Tagged Image File Format
+*.tiff
+*.tif
+
+# Scalable Vector Graphics
+*.svg
+*.svgz
+
+# Portable Document Format
+*.pdf
+
+# X BitMap
+*.xbm
+
+# BMP
+*.bmp
+*.dib
+
+# ICO
+*.ico
+
+# 3D Images
+*.3dm
+*.max
+
+### Octave template
+# Windows default autosave extension
+
+# OSX / *nix default autosave extension
+
+# Compiled MEX binaries (all platforms)
+
+# Packaged app and toolbox files
+
+# Generated helpsearch folders
+
+# Simulink code generation folders
+
+# Matlab code generation folders
+
+# Simulink autosave extension
+
+# Simulink cache files
+
+# Octave session info
+
+### Stata template
+# .gitignore file for git projects containing Stata files
+# Commercial statistical software: http://www.stata.com
+
+# Stata dataset and output files
+*.dta
+*.gph
+*.smcl
+*.stpr
+*.stsem
+
+# Graphic export files from Stata
+# Stata command graph export: http://www.stata.com/manuals14/g-2graphexport.pdf
+#
+# You may add graphic export files to your .gitignore. However you should be
+# aware that this will exclude all image files from this main directory
+# and subdirectories.
+# *.ps
+# *.eps
+# *.wmf
+# *.emf
+# *.pdf
+# *.png
+# *.tif
+
+### KDevelop4 template
+*.kdev4
+.kdev4/
+
+### SlickEdit template
+# SlickEdit workspace and project files are ignored by default because
+# typically they are considered to be developer-specific and not part of a
+# project.
+*.vpw
+*.vpj
+
+# SlickEdit workspace history and tag files always contain user-specific
+# data so they should not be stored in a repository.
+*.vpwhistu
+*.vpwhist
+*.vtg
+
+### Linux template
+*~
+
+# temporary files which can be created if a process still has a handle open of a deleted file
+.fuse_hidden*
+
+# KDE directory preferences
+.directory
+
+# Linux trash folder which might appear on any partition or disk
+.Trash-*
+
+# .nfs files are created when an open file is removed but is still being accessed
+.nfs*
+
+### Ensime template
+# Ensime specific
+.ensime
+.ensime_cache/
+.ensime_lucene/
+
+### Emacs template
+# -*- mode: gitignore; -*-
+\#*\#
+/.emacs.desktop
+/.emacs.desktop.lock
+*.elc
+auto-save-list
+tramp
+.\#*
+
+# Org-mode
+.org-id-locations
+*_archive
+
+# flymake-mode
+*_flymake.*
+
+# eshell files
+/eshell/history
+/eshell/lastdir
+
+# elpa packages
+/elpa/
+
+# reftex files
+*.rel
+
+# AUCTeX auto folder
+/auto/
+
+# cask packages
+.cask/
+dist/
+
+# Flycheck
+flycheck_*.el
+
+# server auth directory
+/server/
+
+# projectiles files
+.projectile
+
+# directory configuration
+.dir-locals.el
+
+# network security
+/network-security.data
+
+
+### XilinxISE template
+# intermediate build files
+*.bgn
+*.bit
+*.bld
+*.cmd_log
+*.drc
+*.ll
+*.lso
+*.msd
+*.msk
+*.ncd
+*.ngc
+*.ngd
+*.ngr
+*.pad
+*.par
+*.pcf
+*.prj
+*.ptwx
+*.rbb
+*.rbd
+*.stx
+*.syr
+*.twr
+*.twx
+*.unroutes
+*.ut
+*.xst
+*_bitgen.xwbt
+*_envsettings.html
+*_map.map
+*_map.mrp
+*_map.ngm
+*_map.xrpt
+*_ngdbuild.xrpt
+*_pad.csv
+*_pad.txt
+*_par.xrpt
+*_summary.html
+*_summary.xml
+*_usage.xml
+*_xst.xrpt
+
+# iMPACT generated files
+_impactbatch.log
+impact.xsl
+impact_impact.xwbt
+ise_impact.cmd
+webtalk_impact.xml
+
+# Core Generator generated files
+xaw2verilog.log
+
+# project-wide generated files
+*.gise
+par_usage_statistics.html
+usage_statistics_webtalk.html
+webtalk.log
+webtalk_pn.xml
+
+# generated folders
+iseconfig/
+xlnx_auto_0_xdb/
+xst/
+_ngo/
+_xmsgs/
+
+### Ansible template
+*.retry
+
+### Calabash template
+# Calabash / Cucumber
+rerun/
+reports/
+screenshots/
+screenshot*.png
+test-servers/
+
+# bundler
+.bundle
+vendor
+
+### Patch template
+*.orig
+*.rej
+
+### Cloud9 template
+# Cloud9 IDE - http://c9.io
+.c9revisions
+.c9
+
+### CVS template
+/CVS/*
+**/CVS/*
+.cvsignore
+*/.cvsignore
+
+### Xcode template
+# Xcode
+#
+# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
+
+## User settings
+xcuserdata/
+
+## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
+*.xcscmblueprint
+*.xccheckout
+
+## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
+build/
+DerivedData/
+*.moved-aside
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+
+## Gcc Patch
+/*.gcno
+
+### Kate template
+# Swap Files #
+.*.kate-swp
+.swp.*
+
+### Mercurial template
+.hg/
+.hgignore
+.hgsigs
+.hgsub
+.hgsubstate
+.hgtags
+
+### Metals template
+ # Generated Metals (Scala Language Server) files
+ # Reference: https://scalameta.org/metals/
+.metals/
+.bloop/
+project/metals.sbt
+
+### Backup template
+*.gho
+*.ori
+
+### LyX template
+# Ignore LyX backup and autosave files
+# http://www.lyx.org/
+*.lyx~
+*.lyx#
+
+### SVN template
+.svn/
+
+### Windows template
+# Windows thumbnail cache files
+Thumbs.db
+Thumbs.db:encryptable
+ehthumbs.db
+ehthumbs_vista.db
+
+# Dump file
+*.stackdump
+
+# Folder config file
+[Dd]esktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.msix
+
+# Windows shortcuts
+*.lnk
+
+### FlexBuilder template
+bin-debug/
+bin-release/
+
+### SublimeText template
+# Cache files for Sublime Text
+*.tmlanguage.cache
+*.tmPreferences.cache
+*.stTheme.cache
+
+# Workspace files are user-specific
+*.sublime-workspace
+
+# Project files should be checked into the repository, unless a significant
+# proportion of contributors will probably not be using Sublime Text
+# *.sublime-project
+
+# SFTP configuration file
+sftp-config.json
+sftp-config-alt*.json
+
+# Package control specific files
+Package Control.last-run
+Package Control.ca-list
+Package Control.ca-bundle
+Package Control.system-ca-bundle
+Package Control.cache/
+Package Control.ca-certs/
+Package Control.merged-ca-bundle
+Package Control.user-ca-bundle
+oscrypto-ca-bundle.crt
+bh_unicode_properties.cache
+
+# Sublime-github package stores a github token in this file
+# https://packagecontrol.io/packages/sublime-github
+GitHub.sublime-settings
+
+### Lazarus template
+# Lazarus compiler-generated binaries (safe to delete)
+*.lrs
+*.res
+*.compiled
+*.dbg
+*.ppu
+*.o
+*.or
+*.a
+
+# Lazarus autogenerated files (duplicated info)
+*.rst
+*.rsj
+*.lrt
+
+# Lazarus local files (user-specific info)
+*.lps
+
+# Lazarus backups and unit output folders.
+# These can be changed by user in Lazarus/project options.
+backup/
+lib/
+
+# Application bundle for Mac OS
+*.app/
+
+### CodeKit template
+# General CodeKit files to ignore
+config.codekit
+config.codekit3
+/min
+
+### BricxCC template
+# Bricx Command Center IDE
+# http://bricxcc.sourceforge.net
+*.sym
+
+### Bazaar template
+.bzr/
+.bzrignore
+
+### LibreOffice template
+# LibreOffice locks
+.~lock.*#
+
+### Dropbox template
+# Dropbox settings and caches
+.dropbox
+.dropbox.attr
+.dropbox.cache
+
+### PSoCCreator template
+# Project Settings
+*.cywrk.*
+*.cyprj.*
+
+# Generated Assets and Resources
+Debug/
+Release/
+Export/
+*/codegentemp
+*/Generated_Source
+*_datasheet.pdf
+*_timing.html
+*.cycdx
+*.cyfit
+*.rpt
+*.svd
+
+### macOS template
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+### JEnv template
+# JEnv local Java version configuration file
+.java-version
+
+# Used by previous versions of JEnv
+.jenv-version
+
+### SBT template
+# Simple Build Tool
+# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control
+
+dist/*
+target/
+lib_managed/
+src_managed/
+project/boot/
+project/plugins/project/
+.history
+.cache
+.lib/
+
+### Otto template
+.otto/
+
+### Espresso template
+*.esproj
+
+### Redcar template
+.redcar
+
+### Redis template
+# Ignore redis binary dump (dump.rdb) files
+
+*.rdb
+
+### Anjuta template
+# Local configuration folder and symbol database
+/.anjuta/
+/.anjuta_sym_db.db
+
+### NetBeans template
+**/nbproject/private/
+**/nbproject/Makefile-*.mk
+**/nbproject/Package-*.bash
+nbbuild/
+nbdist/
+.nb-gradle/
+
+### TextMate template
+*.tmproj
+*.tmproject
+tmtags
+
+### ModelSim template
+# ignore ModelSim generated files and directories (temp files and so on)
+[_@]*
+
+# ignore compilation output of ModelSim
+*.mti
+*.dat
+*.dbs
+*.psm
+*.cmp
+*.html
+*.bsf
+
+# ignore simulation output of ModelSim
+wlf*
+*.wlf
+*.vstf
+*.ucdb
+cov*/
+transcript*
+sc_dpiheader.h
+vsim.dbg
+
+### Vim template
+# Swap
+[._]*.s[a-v][a-z]
+!*.svg  # comment out if you don't need vector files
+[._]*.sw[a-p]
+[._]s[a-rt-v][a-z]
+[._]ss[a-gi-z]
+[._]sw[a-p]
+
+# Session
+Session.vim
+Sessionx.vim
+
+# Temporary
+.netrwhist
+# Auto-generated tag files
+# Persistent undo
+[._]*.un~
+
+### JDeveloper template
+# default application storage directory used by the IDE Performance Cache feature
+.data/
+
+# used for ADF styles caching
+temp/
+
+# default output directories
+classes/
+deploy/
+javadoc/
+
+# lock file, a part of Oracle Credential Store Framework
+cwallet.sso.lck
+### Virtuoso template
+# Gitignore for Cadence Virtuoso
+################################################################
+
+# Log files
+panic*.log.*
+
+# OpenAccess database lock files
+*.cdslck*
+
+# Run directories for layout vs. schematic and design rule check
+lvsRunDir/*
+drcRunDir/*
+
+# Abstract generation tool
+abstract.log*
+abstract.record*
+
+
+### GPG template
+secring.*
+
+
+.idea/
+resouces/
+Deployments/

+ 1046 - 0
.gitignore

@@ -0,0 +1,1046 @@
+### MonoDevelop template
+#User Specific
+*.userprefs
+*.usertasks
+
+#Mono Project Files
+*.pidb
+*.resources
+test-results/
+
+### NotepadPP template
+# Notepad++ backups #
+*.bak
+
+### VisualStudioCode template
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+*.code-workspace
+
+# Local History for Visual Studio Code
+.history/
+
+### VirtualEnv template
+# Virtualenv
+# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
+.Python
+[Bb]in
+[Ii]nclude
+[Ll]ib
+[Ll]ib64
+[Ll]ocal
+[Ss]cripts
+pyvenv.cfg
+.venv
+pip-selfcheck.json
+
+### Diff template
+*.patch
+*.diff
+
+### Eclipse template
+.metadata
+bin/
+tmp/
+*.tmp
+*.swp
+*~.nib
+local.properties
+.settings/
+.loadpath
+.recommenders
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# PyDev specific (Python IDE for Eclipse)
+*.pydevproject
+
+# CDT-specific (C/C++ Development Tooling)
+.cproject
+
+# CDT- autotools
+.autotools
+
+# Java annotation processor (APT)
+.factorypath
+
+# PDT-specific (PHP Development Tools)
+.buildpath
+
+# sbteclipse plugin
+.target
+
+# Tern plugin
+.tern-project
+
+# TeXlipse plugin
+.texlipse
+
+# STS (Spring Tool Suite)
+.springBeans
+
+# Code Recommenders
+.recommenders/
+
+# Annotation Processing
+.apt_generated/
+.apt_generated_test/
+
+# Scala IDE specific (Scala & Java development for Eclipse)
+.cache-main
+.scala_dependencies
+.worksheet
+
+# Uncomment this line if you wish to ignore the project description file.
+# Typically, this file would be tracked if it contains build/dependency configurations:
+#.project
+
+### EiffelStudio template
+# The compilation directory
+EIFGENs
+
+### Go template
+# Binaries for programs and plugins
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Test binary, built with `go test -c`
+*.test
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
+
+# Dependency directories (remove the comment below to include it)
+# vendor/
+
+### Dreamweaver template
+# DW Dreamweaver added files
+_notes
+_compareTemp
+configs/
+dwsync.xml
+dw_php_codehinting.config
+*.mno
+
+### PuTTY template
+# Private key
+*.ppk
+
+### WebMethods template
+**/IntegrationServer/datastore/
+**/IntegrationServer/db/
+**/IntegrationServer/DocumentStore/
+**/IntegrationServer/lib/
+**/IntegrationServer/logs/
+**/IntegrationServer/replicate/
+**/IntegrationServer/sdk/
+**/IntegrationServer/support/
+**/IntegrationServer/update/
+**/IntegrationServer/userFtpRoot/
+**/IntegrationServer/web/
+**/IntegrationServer/WmRepository4/
+**/IntegrationServer/XAStore/
+**/IntegrationServer/packages/Wm*/
+
+### MATLAB template
+# Windows default autosave extension
+*.asv
+
+# OSX / *nix default autosave extension
+*.m~
+
+# Compiled MEX binaries (all platforms)
+*.mex*
+
+# Packaged app and toolbox files
+*.mlappinstall
+*.mltbx
+
+# Generated helpsearch folders
+helpsearch*/
+
+# Simulink code generation folders
+slprj/
+sccprj/
+
+# Matlab code generation folders
+codegen/
+
+# Simulink autosave extension
+*.autosave
+
+# Simulink cache files
+*.slxc
+
+# Octave session info
+octave-workspace
+
+### Vagrant template
+# General
+.vagrant/
+
+# Log files (if you are creating logs in debug mode, uncomment this)
+# *.log
+
+### MicrosoftOffice template
+
+# Word temporary
+~$*.doc*
+
+# Word Auto Backup File
+Backup of *.doc*
+
+# Excel temporary
+~$*.xls*
+
+# Excel Backup File
+*.xlk
+
+# PowerPoint temporary
+~$*.ppt*
+
+# Visio autosave temporary files
+*.~vsd*
+
+### JetBrains template
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+
+# Generated files
+.idea/**/contentModel.xml
+
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+
+# Gradle
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn.  Uncomment if using
+# auto-import.
+# .idea/artifacts
+# .idea/compiler.xml
+# .idea/jarRepositories.xml
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+# *.iml
+# *.ipr
+
+# CMake
+cmake-build-*/
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# File-based project format
+*.iws
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+# Android studio 3.1+ serialized cache file
+.idea/caches/build_file_checksums.ser
+
+### DartEditor template
+.project
+.buildlog
+
+### Ninja template
+.ninja_deps
+.ninja_log
+
+### Archives template
+# It's better to unpack these files and commit the raw source because
+# git has its own built in compression methods.
+*.7z
+*.jar
+*.rar
+*.zip
+*.gz
+*.gzip
+*.tgz
+*.bzip
+*.bzip2
+*.bz2
+*.xz
+*.lzma
+*.cab
+*.xar
+
+# Packing-only formats
+*.iso
+*.tar
+
+# Package management formats
+*.dmg
+*.xpi
+*.gem
+*.egg
+*.deb
+*.rpm
+*.msi
+*.msm
+*.msp
+*.txz
+
+### SynopsysVCS template
+# Waveform formats
+*.vcd
+*.vpd
+*.evcd
+*.fsdb
+
+# Default name of the simulation executable.  A different name can be
+# specified with this switch (the associated daidir database name is
+# also taken from here):  -o <path>/<filename>
+simv
+
+# Generated for Verilog and VHDL top configs
+simv.daidir/
+simv.db.dir/
+
+# Infrastructure necessary to co-simulate SystemC models with
+# Verilog/VHDL models.  An alternate directory may be specified with this
+# switch:  -Mdir=<directory_path>
+csrc/
+
+# Log file - the following switch allows to specify the file that will be
+# used to write all messages from simulation:  -l <filename>
+*.log
+
+# Coverage results (generated with urg) and database location.  The
+# following switch can also be used:  urg -dir <coverage_directory>.vdb
+simv.vdb/
+urgReport/
+
+# DVE and UCLI related files.
+DVEfiles/
+ucli.key
+
+# When the design is elaborated for DirectC, the following file is created
+# with declarations for C/C++ functions.
+vc_hdrs.h
+
+### Tags template
+# Ignore tags created by etags, ctags, gtags (GNU global) and cscope
+TAGS
+.TAGS
+!TAGS/
+tags
+.tags
+!tags/
+gtags.files
+GTAGS
+GRTAGS
+GPATH
+GSYMS
+cscope.files
+cscope.out
+cscope.in.out
+cscope.po.out
+
+
+### TortoiseGit template
+# Project-level settings
+/.tgitconfig
+
+### Momentics template
+# Built files
+x86/
+arm/
+arm-p/
+translations/*.qm
+
+# IDE settings
+
+### Images template
+# JPEG
+*.jpg
+*.jpeg
+*.jpe
+*.jif
+*.jfif
+*.jfi
+
+# JPEG 2000
+*.jp2
+*.j2k
+*.jpf
+*.jpx
+*.jpm
+*.mj2
+
+# JPEG XR
+*.jxr
+*.hdp
+*.wdp
+
+# Graphics Interchange Format
+*.gif
+
+# RAW
+*.raw
+
+# Web P
+*.webp
+
+# Portable Network Graphics
+*.png
+
+# Animated Portable Network Graphics
+*.apng
+
+# Multiple-image Network Graphics
+*.mng
+
+# Tagged Image File Format
+*.tiff
+*.tif
+
+# Scalable Vector Graphics
+*.svg
+*.svgz
+
+# Portable Document Format
+*.pdf
+
+# X BitMap
+*.xbm
+
+# BMP
+*.bmp
+*.dib
+
+# ICO
+*.ico
+
+# 3D Images
+*.3dm
+*.max
+
+### Octave template
+# Windows default autosave extension
+
+# OSX / *nix default autosave extension
+
+# Compiled MEX binaries (all platforms)
+
+# Packaged app and toolbox files
+
+# Generated helpsearch folders
+
+# Simulink code generation folders
+
+# Matlab code generation folders
+
+# Simulink autosave extension
+
+# Simulink cache files
+
+# Octave session info
+
+### Stata template
+# .gitignore file for git projects containing Stata files
+# Commercial statistical software: http://www.stata.com
+
+# Stata dataset and output files
+*.dta
+*.gph
+*.smcl
+*.stpr
+*.stsem
+
+# Graphic export files from Stata
+# Stata command graph export: http://www.stata.com/manuals14/g-2graphexport.pdf
+#
+# You may add graphic export files to your .gitignore. However you should be
+# aware that this will exclude all image files from this main directory
+# and subdirectories.
+# *.ps
+# *.eps
+# *.wmf
+# *.emf
+# *.pdf
+# *.png
+# *.tif
+
+### KDevelop4 template
+*.kdev4
+.kdev4/
+
+### SlickEdit template
+# SlickEdit workspace and project files are ignored by default because
+# typically they are considered to be developer-specific and not part of a
+# project.
+*.vpw
+*.vpj
+
+# SlickEdit workspace history and tag files always contain user-specific
+# data so they should not be stored in a repository.
+*.vpwhistu
+*.vpwhist
+*.vtg
+
+### Linux template
+*~
+
+# temporary files which can be created if a process still has a handle open of a deleted file
+.fuse_hidden*
+
+# KDE directory preferences
+.directory
+
+# Linux trash folder which might appear on any partition or disk
+.Trash-*
+
+# .nfs files are created when an open file is removed but is still being accessed
+.nfs*
+
+### Ensime template
+# Ensime specific
+.ensime
+.ensime_cache/
+.ensime_lucene/
+
+### Emacs template
+# -*- mode: gitignore; -*-
+\#*\#
+/.emacs.desktop
+/.emacs.desktop.lock
+*.elc
+auto-save-list
+tramp
+.\#*
+
+# Org-mode
+.org-id-locations
+*_archive
+
+# flymake-mode
+*_flymake.*
+
+# eshell files
+/eshell/history
+/eshell/lastdir
+
+# elpa packages
+/elpa/
+
+# reftex files
+*.rel
+
+# AUCTeX auto folder
+/auto/
+
+# cask packages
+.cask/
+dist/
+
+# Flycheck
+flycheck_*.el
+
+# server auth directory
+/server/
+
+# projectiles files
+.projectile
+
+# directory configuration
+.dir-locals.el
+
+# network security
+/network-security.data
+
+
+### XilinxISE template
+# intermediate build files
+*.bgn
+*.bit
+*.bld
+*.cmd_log
+*.drc
+*.ll
+*.lso
+*.msd
+*.msk
+*.ncd
+*.ngc
+*.ngd
+*.ngr
+*.pad
+*.par
+*.pcf
+*.prj
+*.ptwx
+*.rbb
+*.rbd
+*.stx
+*.syr
+*.twr
+*.twx
+*.unroutes
+*.ut
+*.xst
+*_bitgen.xwbt
+*_envsettings.html
+*_map.map
+*_map.mrp
+*_map.ngm
+*_map.xrpt
+*_ngdbuild.xrpt
+*_pad.csv
+*_pad.txt
+*_par.xrpt
+*_summary.html
+*_summary.xml
+*_usage.xml
+*_xst.xrpt
+
+# iMPACT generated files
+_impactbatch.log
+impact.xsl
+impact_impact.xwbt
+ise_impact.cmd
+webtalk_impact.xml
+
+# Core Generator generated files
+xaw2verilog.log
+
+# project-wide generated files
+*.gise
+par_usage_statistics.html
+usage_statistics_webtalk.html
+webtalk.log
+webtalk_pn.xml
+
+# generated folders
+iseconfig/
+xlnx_auto_0_xdb/
+xst/
+_ngo/
+_xmsgs/
+
+### Ansible template
+*.retry
+
+### Calabash template
+# Calabash / Cucumber
+rerun/
+reports/
+screenshots/
+screenshot*.png
+test-servers/
+
+# bundler
+.bundle
+vendor
+
+### Patch template
+*.orig
+*.rej
+
+### Cloud9 template
+# Cloud9 IDE - http://c9.io
+.c9revisions
+.c9
+
+### CVS template
+/CVS/*
+**/CVS/*
+.cvsignore
+*/.cvsignore
+
+### Xcode template
+# Xcode
+#
+# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
+
+## User settings
+xcuserdata/
+
+## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
+*.xcscmblueprint
+*.xccheckout
+
+## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
+build/
+DerivedData/
+*.moved-aside
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+
+## Gcc Patch
+/*.gcno
+
+### Kate template
+# Swap Files #
+.*.kate-swp
+.swp.*
+
+### Mercurial template
+.hg/
+.hgignore
+.hgsigs
+.hgsub
+.hgsubstate
+.hgtags
+
+### Metals template
+ # Generated Metals (Scala Language Server) files
+ # Reference: https://scalameta.org/metals/
+.metals/
+.bloop/
+project/metals.sbt
+
+### Backup template
+*.gho
+*.ori
+
+### LyX template
+# Ignore LyX backup and autosave files
+# http://www.lyx.org/
+*.lyx~
+*.lyx#
+
+### SVN template
+.svn/
+
+### Windows template
+# Windows thumbnail cache files
+Thumbs.db
+Thumbs.db:encryptable
+ehthumbs.db
+ehthumbs_vista.db
+
+# Dump file
+*.stackdump
+
+# Folder config file
+[Dd]esktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.msix
+
+# Windows shortcuts
+*.lnk
+
+### FlexBuilder template
+bin-debug/
+bin-release/
+
+### SublimeText template
+# Cache files for Sublime Text
+*.tmlanguage.cache
+*.tmPreferences.cache
+*.stTheme.cache
+
+# Workspace files are user-specific
+*.sublime-workspace
+
+# Project files should be checked into the repository, unless a significant
+# proportion of contributors will probably not be using Sublime Text
+# *.sublime-project
+
+# SFTP configuration file
+sftp-config.json
+sftp-config-alt*.json
+
+# Package control specific files
+Package Control.last-run
+Package Control.ca-list
+Package Control.ca-bundle
+Package Control.system-ca-bundle
+Package Control.cache/
+Package Control.ca-certs/
+Package Control.merged-ca-bundle
+Package Control.user-ca-bundle
+oscrypto-ca-bundle.crt
+bh_unicode_properties.cache
+
+# Sublime-github package stores a github token in this file
+# https://packagecontrol.io/packages/sublime-github
+GitHub.sublime-settings
+
+### Lazarus template
+# Lazarus compiler-generated binaries (safe to delete)
+*.lrs
+*.res
+*.compiled
+*.dbg
+*.ppu
+*.o
+*.or
+*.a
+
+# Lazarus autogenerated files (duplicated info)
+*.rst
+*.rsj
+*.lrt
+
+# Lazarus local files (user-specific info)
+*.lps
+
+# Lazarus backups and unit output folders.
+# These can be changed by user in Lazarus/project options.
+backup/
+lib/
+
+# Application bundle for Mac OS
+*.app/
+
+### CodeKit template
+# General CodeKit files to ignore
+config.codekit
+config.codekit3
+/min
+
+### BricxCC template
+# Bricx Command Center IDE
+# http://bricxcc.sourceforge.net
+*.sym
+
+### Bazaar template
+.bzr/
+.bzrignore
+
+### LibreOffice template
+# LibreOffice locks
+.~lock.*#
+
+### Dropbox template
+# Dropbox settings and caches
+.dropbox
+.dropbox.attr
+.dropbox.cache
+
+### PSoCCreator template
+# Project Settings
+*.cywrk.*
+*.cyprj.*
+
+# Generated Assets and Resources
+Debug/
+Release/
+Export/
+*/codegentemp
+*/Generated_Source
+*_datasheet.pdf
+*_timing.html
+*.cycdx
+*.cyfit
+*.rpt
+*.svd
+
+### macOS template
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+### JEnv template
+# JEnv local Java version configuration file
+.java-version
+
+# Used by previous versions of JEnv
+.jenv-version
+
+### SBT template
+# Simple Build Tool
+# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control
+
+dist/*
+target/
+lib_managed/
+src_managed/
+project/boot/
+project/plugins/project/
+.history
+.cache
+.lib/
+
+### Otto template
+.otto/
+
+### Espresso template
+*.esproj
+
+### Redcar template
+.redcar
+
+### Redis template
+# Ignore redis binary dump (dump.rdb) files
+
+*.rdb
+
+### Anjuta template
+# Local configuration folder and symbol database
+/.anjuta/
+/.anjuta_sym_db.db
+
+### NetBeans template
+**/nbproject/private/
+**/nbproject/Makefile-*.mk
+**/nbproject/Package-*.bash
+nbbuild/
+nbdist/
+.nb-gradle/
+
+### TextMate template
+*.tmproj
+*.tmproject
+tmtags
+
+### ModelSim template
+# ignore ModelSim generated files and directories (temp files and so on)
+[_@]*
+
+# ignore compilation output of ModelSim
+*.mti
+*.dat
+*.dbs
+*.psm
+*.cmp
+*.html
+*.bsf
+
+# ignore simulation output of ModelSim
+wlf*
+*.wlf
+*.vstf
+*.ucdb
+cov*/
+transcript*
+sc_dpiheader.h
+vsim.dbg
+
+### Vim template
+# Swap
+[._]*.s[a-v][a-z]
+!*.svg  # comment out if you don't need vector files
+[._]*.sw[a-p]
+[._]s[a-rt-v][a-z]
+[._]ss[a-gi-z]
+[._]sw[a-p]
+
+# Session
+Session.vim
+Sessionx.vim
+
+# Temporary
+.netrwhist
+# Auto-generated tag files
+# Persistent undo
+[._]*.un~
+
+### JDeveloper template
+# default application storage directory used by the IDE Performance Cache feature
+.data/
+
+# used for ADF styles caching
+temp/
+
+# default output directories
+classes/
+deploy/
+javadoc/
+
+# lock file, a part of Oracle Credential Store Framework
+cwallet.sso.lck
+### Virtuoso template
+# Gitignore for Cadence Virtuoso
+################################################################
+
+# Log files
+panic*.log.*
+
+# OpenAccess database lock files
+*.cdslck*
+
+# Run directories for layout vs. schematic and design rule check
+lvsRunDir/*
+drcRunDir/*
+
+# Abstract generation tool
+abstract.log*
+abstract.record*
+
+
+### GPG template
+secring.*
+.idea/
+

+ 21 - 0
Deployments/Dockerfile

@@ -0,0 +1,21 @@
+FROM golang:1.16 as builder
+# Setting environment variables
+ENV GOPROXY="https://goproxy.cn,direct" \
+    GO111MODULE="on" \
+    CGO_ENABLED="0" \
+    GOOS="linux" \
+    GOARCH="amd64"
+
+# Switch to workspace
+WORKDIR /go/src/github.com/gowebspider/jsrpc/
+# Load file
+COPY . .
+# add rely
+# Build and place the results in /tmp/jsrpc
+RUN  go mod tidy && go build -o /tmp/jsrpc .
+
+FROM alpine:latest
+WORKDIR /root/
+COPY --from=builder /tmp/jsrpc .
+EXPOSE 12080 12443
+CMD ["./jsrpc"]

+ 42 - 0
Deployments/deployment.yml

@@ -0,0 +1,42 @@
+apiVersion: apps/v1
+kind: Deployments
+metadata:
+  name: jsrpc
+  labels:
+    app: jsrpc
+spec:
+  replicas: 3
+  template:
+    metadata:
+      name: jsrpc
+      labels:
+        app: jsrpc
+    spec:
+      containers:
+        - name: jsrpc
+          image:
+          imagePullPolicy: Always
+          ports:
+            - containerPort: 12080
+            - containerPort: 12443
+      restartPolicy: Always
+  selector:
+    matchLabels:
+      app: jsrpc
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: jsrpc
+spec:
+  selector:
+    app: jsrpc
+  type: NodePort
+  ports:
+    - name: basic
+      port: 12080
+      nodePort: 32080
+    - name: ssl
+      port: 12443
+      nodePort: 32443

+ 10 - 0
Deployments/docker-compose.yml

@@ -0,0 +1,10 @@
+version: "3.8"
+services:
+  jsrpc:
+    deploy:
+      replicas: 3
+    image: "${}"
+    ports:
+      - "12080:12080"
+      - "12443:12443"
+    restart: always

+ 7 - 2
README.md

@@ -43,8 +43,9 @@
 - `/ws`  :浏览器注入ws连接的接口
 - `/result` :获取数据的接口  (数据格式json: {"group":"hhh","hello":"好困啊yes","name":"baidu","status":"200"} )
 
-  说明:接口用?group和name来区分 如 ws://127.0.0.1:12080/ws?group={}&name={}" //注入ws的例子 group和name都可以随便
-  http://127.0.0.1:12080/go?group={}&name={}&action={}&param={} //这是调用的接口 group和name填写上面注入时候的,action是注册的方法名,param是可选的参数
+
+说明:接口用?group和name来区分 如 ws://127.0.0.1:12080/ws?group={}&name={}" //注入ws的例子 group和name都可以随便
+http://127.0.0.1:12080/go?group={}&name={}&action={}&param={} //这是调用的接口 group和name填写上面注入时候的,action是注册的方法名,param是可选的参数
 
 ### 注入JS,构建通信环境
 
@@ -107,3 +108,7 @@ http://127.0.0.1:12080/go?group=hhh&name=baidu&action=hello&param=yes
 
     控制台可以关,但是注入的网页不要关哦
 
+## TODO
+
+- [ ] ssl Docker Deploy
+- [ ] K8s Deploy

+ 67 - 49
main.go

@@ -12,15 +12,21 @@ import (
 	"time"
 )
 
-//设置http版的端口号
-var LocalPort = ":12080"
 
-//设置https版的端口号(需带证书的)
-var sslPort = ":12443"
-
-// OverTime 设置接口没得到结果时的超时时间
-var OverTime = time.Second * 20
+var (
+	// BasicPort The original port without SSL certificate
+	BasicPort = `:12080`
+	// SSLPort "Secure" port with SSL certificate
+	SSLPort = `:12443`
+	// websocket.Upgrader specifies parameters for upgrading an HTTP connection to a
+	// WebSocket connection.
+	upGrader = websocket.Upgrader{
+		CheckOrigin: func(r *http.Request) bool { return true },
+	}
+	hlSyncMap sync.Map
+)
 
+// Clients provides Connect instance for a job
 type Clients struct {
 	clientGroup string
 	clientName  string
@@ -28,8 +34,13 @@ type Clients struct {
 	clientWs    *websocket.Conn
 }
 
-var upGrader = websocket.Upgrader{
-	CheckOrigin: func(r *http.Request) bool { return true },
+// NewClients initializes a new Clients instance
+func NewClients(clientGroup string, clientName string, clientWs *websocket.Conn) *Clients {
+	return &Clients{
+		clientGroup: clientGroup,
+		clientName:  clientName,
+		clientWs:    clientWs,
+	}
 }
 
 var hlClients sync.Map
@@ -43,9 +54,10 @@ func NewClient(group string, name string, ws *websocket.Conn) *Clients {
 	}
 }
 
+// ws, provides inject function for a job
 func ws(c *gin.Context) {
-	getGroup, getName := c.Query("group"), c.Query("name")
-	if getGroup == "" || getName == "" {
+	group, name := c.Query("group"), c.Query("name")
+	if group == "" || name == "" {
 		return
 	}
 	ws, err := upGrader.Upgrade(c.Writer, c.Request, nil)
@@ -53,10 +65,9 @@ func ws(c *gin.Context) {
 		fmt.Println("websocket err:", err)
 		return
 	}
-	client := NewClient(getGroup, getName, ws)
-	hlClients.Store(getGroup+"->"+getName, client)
+	client := NewClients(group, name, ws)
+	hlSyncMap.Store(group+"->"+name, client)
 	for {
-		//等待数据
 		_, message, err := ws.ReadMessage()
 		if err != nil {
 			break
@@ -67,6 +78,7 @@ func ws(c *gin.Context) {
 		if strIndex >= 1 {
 			action := msg[:strIndex]
 
+
 			client.Data[action] = msg[strIndex+5:]
 			fmt.Println("get_message:", client.Data[action])
 			hlClients.Store(getGroup+"->"+getName, client)
@@ -103,50 +115,56 @@ func Go(c *gin.Context) {
 		return
 	}
 	clientName, ok := hlClients.Load(getGroup + "->" + getName)
+=======
+	hlSyncMap.Delete(group + "->" + name)
+	defer ws.Close()
+}
+
+// ResultSet provides get result function for a job
+// you can use it to Remote operation and get results
+func ResultSet(c *gin.Context) {
+	group := c.Query("group")
+	name := c.Query("name")
+	action := c.Query("action")
+	param := c.Query("param")
+
+	if group == "" || name == "" {
+		c.String(200, "input group and name")
+		return
+	}
+	fmt.Println(group + "->" + name)
+	clientName, ok := hlSyncMap.Load(group + "->" + name)
+	fmt.Println(clientName)
 	if ok == false {
 		c.String(200, "注入了ws?没有找到当前组和名字")
 		return
 	}
-	if Action == "" {
-		c.JSON(200, gin.H{"group": getGroup, "name": getName})
+	if action == "" {
+		c.JSON(200, gin.H{"group": group, "name": name})
 		return
 	}
-	//取一个ws客户端
-	client, ko := clientName.(*Clients)
-	if !ko {
-		return
+
+	value, ko := clientName.(*Clients)
+	if value.Data[action] == nil {
+		value.Data[action] = make(chan string, 1)
 	}
-	//发送数据到web里得到结果
-	QueryFunc(client, Action, getParam)
+	QueryFunc(value, action, param)
+	data := <-value.Data[action]
 
-	ctx, cancel := context.WithTimeout(context.Background(), OverTime)
-	for {
-		select {
-		case <-ctx.Done():
-			// 获取数据超时了
-			cancel()
-			return
-		default:
-			data := client.Data[Action]
-			//fmt.Println("正常中")
-			if data != "" {
-				cancel()
-				//这里设置为空是为了清除上次的结果并且赋值判断
-				client.Data[Action] = ""
-				c.JSON(200, gin.H{"status": "200", "group": client.clientGroup, "name": client.clientName, Action: data})
-			} else {
-				time.Sleep(time.Millisecond * 500)
-			}
-		}
+	if ko {
+		c.JSON(200, gin.H{"status": "200", "group": value.clientGroup, "name": value.clientName, action: data})
+	} else {
+		c.JSON(666, gin.H{"message": "?"})
 	}
 
 }
 
-func getList(c *gin.Context) {
+// ClientConnectionList provides get client connect list for a job
+// you can use it see all Connection
+func ClientConnectionList(c *gin.Context) {
 	resList := "hliang:\r\n"
-	hlClients.Range(func(key, value interface{}) bool {
+	hlSyncMap.Range(func(key, value interface{}) bool {
 		resList += key.(string) + "\r\n\t"
-
 		return true
 	})
 	c.String(200, resList)
@@ -160,7 +178,7 @@ func TlsHandler() gin.HandlerFunc {
 	return func(c *gin.Context) {
 		secureMiddleware := secure.New(secure.Options{
 			SSLRedirect: true,
-			SSLHost:     sslPort,
+			SSLHost:     SSLPort,
 		})
 		err := secureMiddleware.Process(c.Writer, c.Request)
 		if err != nil {
@@ -174,12 +192,12 @@ func TlsHandler() gin.HandlerFunc {
 func main() {
 	//设置获取数据的超时时间30秒
 	r := gin.Default()
-	r.GET("/", Index)
-	r.GET("/go", Go)
+	r.GET("/result", ResultSet)
 	r.GET("/ws", ws)
-	r.GET("/list", getList)
+	r.GET("/list", ClientConnectionList)
 	r.Use(TlsHandler())
 	_ = r.Run(LocalPort)
 	//_ = r.RunTLS(sslPort, "zhengshu.pem", "zhengshu.key")
-
+	r.Run(BasicPort)
+	//r.RunTLS(SSLPort, "zhengshu.pem", "zhengshu.key")
 }

+ 83 - 83
JsEnv.js → resouces/JsEnv.js

@@ -1,83 +1,83 @@
-function Hlclient(wsURL) {
-    this.wsURL = wsURL;
-    this.handlers = {};
-    this.socket = {};
-
-    if (!wsURL) {
-        throw new Error('wsURL can not be empty!!')
-    }
-    this.connect()
-}
-
-Hlclient.prototype.connect = function () {
-    console.log('begin of connect to wsURL: ' + this.wsURL);
-    var _this = this;
-    try {
-        this.socket["ySocket"] = new WebSocket(this.wsURL);
-        this.socket["ySocket"].onmessage = function (e) {
-            console.log("send func", e.data);
-            _this.handlerRequest(e.data);
-        }
-    } catch (e) {
-        console.log("connection failed,reconnect after 10s");
-        setTimeout(function () {
-            _this.connect()
-        }, 10000)
-    }
-    this.socket["ySocket"].onclose = function () {
-        console.log("connection failed,reconnect after 10s");
-        setTimeout(function () {
-            _this.connect()
-        }, 10000)
-    }
-
-};
-Hlclient.prototype.send = function (msg) {
-    this.socket["ySocket"].send(msg)
-}
-
-Hlclient.prototype.regAction = function (func_name, func) {
-    if (typeof func_name !== 'string') {
-        throw new Error("an func_name must be string");
-    }
-    if (typeof func !== 'function') {
-        throw new Error("must be function");
-    }
-    console.log("register func_name: " + func_name);
-    this.handlers[func_name] = func;
-
-}
-Hlclient.prototype.handlerRequest = function (requestJson) {
-	var _this = this;
-	var result=JSON.parse(requestJson);
-	//console.log(result)
-	if (!result['action']) {
-        this.sendResult('','need request param {action}');
-        return
-}
-    action=result["action"]
-    var theHandler = this.handlers[action];
-    if (!theHandler ||theHandler==undefined){
-	    this.sendResult(action,'action not found');
-	    return
-    }
-    try {
-		if (!result["param"]){
-			theHandler(function (response) {
-				_this.sendResult(action, response);
-			})
-		}else{
-			theHandler(function (response) {
-				_this.sendResult(action, response);
-			},result["param"])
-		}
-		
-    } catch (e) {
-        console.log("error: " + e);
-        _this.sendResult(action+e);
-    }
-}
-
-Hlclient.prototype.sendResult = function (action, e) {
-    this.send(action + atob("aGxeX14") + e);
-}
+function Hlclient(wsURL) {
+    this.wsURL = wsURL;
+    this.handlers = {};
+    this.socket = {};
+
+    if (!wsURL) {
+        throw new Error('wsURL can not be empty!!')
+    }
+    this.connect()
+}
+
+Hlclient.prototype.connect = function () {
+    console.log('begin of connect to wsURL: ' + this.wsURL);
+    var _this = this;
+    try {
+        this.socket["ySocket"] = new WebSocket(this.wsURL);
+        this.socket["ySocket"].onmessage = function (e) {
+            console.log("send func", e.data);
+            _this.handlerRequest(e.data);
+        }
+    } catch (e) {
+        console.log("connection failed,reconnect after 10s");
+        setTimeout(function () {
+            _this.connect()
+        }, 10000)
+    }
+    this.socket["ySocket"].onclose = function () {
+        console.log("connection failed,reconnect after 10s");
+        setTimeout(function () {
+            _this.connect()
+        }, 10000)
+    }
+
+};
+Hlclient.prototype.send = function (msg) {
+    this.socket["ySocket"].send(msg)
+}
+
+Hlclient.prototype.regAction = function (func_name, func) {
+    if (typeof func_name !== 'string') {
+        throw new Error("an func_name must be string");
+    }
+    if (typeof func !== 'function') {
+        throw new Error("must be function");
+    }
+    console.log("register func_name: " + func_name);
+    this.handlers[func_name] = func;
+
+}
+Hlclient.prototype.handlerRequest = function (requestJson) {
+	var _this = this;
+	var result=JSON.parse(requestJson);
+	//console.log(result)
+	if (!result['action']) {
+        this.sendResult('','need request param {action}');
+        return
+}
+    action=result["action"]
+    var theHandler = this.handlers[action];
+    if (!theHandler ||theHandler==undefined){
+	    this.sendResult(action,'action not found');
+	    return
+    }
+    try {
+		if (!result["param"]){
+			theHandler(function (response) {
+				_this.sendResult(action, response);
+			})
+		}else{
+			theHandler(function (response) {
+				_this.sendResult(action, response);
+			},result["param"])
+		}
+		
+    } catch (e) {
+        console.log("error: " + e);
+        _this.sendResult(action+e);
+    }
+}
+
+Hlclient.prototype.sendResult = function (action, e) {
+    this.send(action + atob("aGxeX14") + e);
+}