2016-03-25 01:23:46 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"github.com/gin-gonic/gin"
|
2016-03-25 02:40:29 +00:00
|
|
|
"runtime"
|
2016-03-25 01:23:46 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func PrintGoPushVersion() {
|
|
|
|
fmt.Printf(`GoPush %s Compiler: %s %s Copyright (C) 2016 Bo-Yi Wu, Inc.`,
|
|
|
|
Version,
|
|
|
|
runtime.Compiler,
|
|
|
|
runtime.Version())
|
|
|
|
}
|
|
|
|
|
|
|
|
func VersionMiddleware() gin.HandlerFunc {
|
|
|
|
// Set out header value for each response
|
|
|
|
return func(c *gin.Context) {
|
|
|
|
c.Writer.Header().Set("Server-Version", "GoPush "+Version)
|
|
|
|
c.Next()
|
|
|
|
}
|
|
|
|
}
|