Browse Source

update version 1.0.3

master
luamas 1 year ago
parent
commit
fd13f4aa8e
4 changed files with 16 additions and 5 deletions
  1. +1
    -1
      config.sh
  2. +1
    -1
      help/version.go
  3. +7
    -1
      jetbrain/jetbrains.go
  4. +7
    -2
      main.go

+ 1
- 1
config.sh View File

@@ -1,3 +1,3 @@
#!/usr/bin/env bash

version=v1.0.3
version=v1.0.4

+ 1
- 1
help/version.go View File

@@ -5,7 +5,7 @@ import (
"runtime"
)

const version="v1.0.3"
const version="v1.0.4"

func Version() {
fmt.Printf("license-server_%s_%s(%s)\n", runtime.GOOS, runtime.GOARCH, version)


+ 7
- 1
jetbrain/jetbrains.go View File

@@ -17,6 +17,9 @@ type JetbrainBaseResponse struct {
ResponseCode string `xml:"responseCode"`
Message string `xml:"message"`
Salt string `xml:"salt"`
Action string `xml:"action"`
ValidationPeriod int64 `xml:"validationPeriod"`
ValidationDeadlinePeriod int64 `xml:"validationDeadlinePeriod"`
}

type PingResponse struct {
@@ -40,11 +43,14 @@ type ReleaseTicketResponse struct {
JetbrainBaseResponse
}

func Jetbrains(w http.ResponseWriter, r *http.Request, userName string, prolongationPeriod int64) {
func Jetbrains(w http.ResponseWriter, r *http.Request, userName string, prolongationPeriod int64, validationPeriod int64, validationDeadlinePeriod int64) {
salt := r.FormValue("salt")
jetbrainBaseResponse := JetbrainBaseResponse{
ResponseCode: "OK",
Salt: salt,
Action: "NONE",
ValidationPeriod: validationPeriod,
ValidationDeadlinePeriod: validationDeadlinePeriod,
}
var xmlResponse string
isPing, err1 := regexp.MatchString("/rpc/ping.*", r.URL.Path)


+ 7
- 2
main.go View File

@@ -18,6 +18,8 @@ import (

var userName string
var prolongationPeriod int64
var validationPeriod int64
var validationDeadlinePeriod int64
var isUserNameEnv bool


@@ -26,7 +28,10 @@ func main() {
log.SetOutput(os.Stdout)
versionMode := flag.Bool("v", false, "show version")
host := flag.String("host", "0.0.0.0", "bind on host")
flag.Int64Var(&prolongationPeriod, "prolongationPeriod", 607875500, "prolong ation period")
flag.Int64Var(&prolongationPeriod, "prolongationPeriod", 607875500, "prolong ation period(延长期)")
flag.Int64Var(&validationPeriod, "validationPeriod", 607875500, "validation period(验证周期)")
flag.Int64Var(&validationDeadlinePeriod, "validationDeadlinePeriod", 607875500, "validation deadline period(验证截止期限)")

port := flag.Int("port", 22508, "port number")
if userName == "" {
flag.StringVar(&userName, "u", "luamas", "If you want to use a local user name, fill in empty such, -u empty")
@@ -101,7 +106,7 @@ func urlMatcher(_ http.Handler) http.Handler {
}
isJetbrains, err2 := regexp.MatchString("/rpc/.*\\.action", r.URL.Path)
if err2 == nil && isJetbrains {
jetbrain.Jetbrains(w, r, userName, prolongationPeriod)
jetbrain.Jetbrains(w, r, userName, prolongationPeriod,validationPeriod,validationDeadlinePeriod)
return
}
isJetbrainsMybatis, err2 := regexp.MatchString("/activate", r.URL.Path)


Loading…
Cancel
Save