@@ -1,10 +1,5 @@
|
||||
package gorush
|
||||
|
||||
const (
|
||||
// Version is gorush server version.
|
||||
Version = "1.2.1"
|
||||
)
|
||||
|
||||
const (
|
||||
// PlatFormIos constant is 1 for iOS
|
||||
PlatFormIos = iota + 1
|
||||
|
||||
@@ -6,10 +6,16 @@ import (
|
||||
"runtime"
|
||||
)
|
||||
|
||||
var version string
|
||||
|
||||
func SetVersion(ver string) {
|
||||
version = ver
|
||||
}
|
||||
|
||||
// PrintGoRushVersion provide print server engine
|
||||
func PrintGoRushVersion() {
|
||||
fmt.Printf(`GoRush %s, Compiler: %s %s, Copyright (C) 2016 Bo-Yi Wu, Inc.`,
|
||||
Version,
|
||||
version,
|
||||
runtime.Compiler,
|
||||
runtime.Version())
|
||||
}
|
||||
@@ -18,7 +24,7 @@ func PrintGoRushVersion() {
|
||||
func VersionMiddleware() gin.HandlerFunc {
|
||||
// Set out header value for each response
|
||||
return func(c *gin.Context) {
|
||||
c.Writer.Header().Set("Server-Version", "GoRush/"+Version)
|
||||
c.Writer.Header().Set("Server-Version", "GoRush/"+version)
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user