release: version 3.1.2
This commit is contained in:
20
.github/change_version.sh
vendored
Executable file
20
.github/change_version.sh
vendored
Executable file
@@ -0,0 +1,20 @@
|
||||
#! /bin/bash
|
||||
echo "previous version was $(git describe --tags $(git rev-list --tags --max-count=1))"
|
||||
echo "WARNING: This operation will creates version tag and push to github"
|
||||
read -p "Version? (provide the next x.y.z semver) : " TAG
|
||||
echo $TAG &&\
|
||||
[[ "$TAG" =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(\.dev)?$ ]] || { echo "Incorrect tag. e.g., 1.2.3 or 1.2.3.dev"; exit 1; }
|
||||
IFS="." read -r -a VERSION_ARRAY <<< "$TAG"
|
||||
VERSION_STR="${VERSION_ARRAY[0]}.${VERSION_ARRAY[1]}.${VERSION_ARRAY[2]}"
|
||||
BUILD_NUMBER=$(( ${VERSION_ARRAY[0]} * 10000 + ${VERSION_ARRAY[1]} * 100 + ${VERSION_ARRAY[2]} ))
|
||||
echo "version: ${VERSION_STR}+${BUILD_NUMBER}"
|
||||
sed -i -e "s|<key>CFBundleVersion</key>\s*<string>[^<]*</string>|<key>CFBundleVersion</key><string>${VERSION_STR}</string>|" Info.plist &&\
|
||||
sed -i -e "s|<key>CFBundleShortVersionString</key>\s*<string>[^<]*</string>|<key>CFBundleShortVersionString</key><string>${VERSION_STR}</string>|" Info.plist &&\
|
||||
sed -i "s|ENV VERSION=.*|ENV VERSION=v${TAG}|g" docker/Dockerfile
|
||||
git add Info.plist docker/Dockerfile
|
||||
git commit -m "release: version ${TAG}"
|
||||
echo "creating git tag : v${TAG}"
|
||||
git push
|
||||
git tag v${TAG}
|
||||
git push -u origin HEAD --tags
|
||||
echo "Github Actions will detect the new tag and release the new version."'
|
||||
@@ -42,8 +42,8 @@
|
||||
<string>1.0</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>ios.libcore.hiddify</string>
|
||||
<key>CFBundleShortVersionString</key><string>3.1.1</string>
|
||||
<key>CFBundleVersion</key><string>3.1.1</string>
|
||||
<key>CFBundleShortVersionString</key><string>3.1.2</string>
|
||||
<key>CFBundleVersion</key><string>3.1.2</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>15.0</string>
|
||||
</dict>
|
||||
|
||||
24
Makefile
24
Makefile
@@ -100,26 +100,8 @@ clean:
|
||||
|
||||
|
||||
|
||||
release: # Create a new tag for release.
|
||||
@echo "previous version was $$(git describe --tags $$(git rev-list --tags --max-count=1))"
|
||||
@echo "WARNING: This operation will creates version tag and push to github"
|
||||
@bash -c '\
|
||||
read -p "Version? (provide the next x.y.z semver) : " TAG && \
|
||||
echo $$TAG &&\
|
||||
[[ "$$TAG" =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(\.dev)?$$ ]] || { echo "Incorrect tag. e.g., 1.2.3 or 1.2.3.dev"; exit 1; } && \
|
||||
IFS="." read -r -a VERSION_ARRAY <<< "$$TAG" && \
|
||||
VERSION_STR="$${VERSION_ARRAY[0]}.$${VERSION_ARRAY[1]}.$${VERSION_ARRAY[2]}" && \
|
||||
BUILD_NUMBER=$$(( $${VERSION_ARRAY[0]} * 10000 + $${VERSION_ARRAY[1]} * 100 + $${VERSION_ARRAY[2]} )) && \
|
||||
echo "version: $${VERSION_STR}+$${BUILD_NUMBER}" && \
|
||||
sed -i -e "s|<key>CFBundleVersion</key>\s*<string>[^<]*</string>|<key>CFBundleVersion</key><string>$${VERSION_STR}</string>|" Info.plist &&\
|
||||
sed -i -e "s|<key>CFBundleShortVersionString</key>\s*<string>[^<]*</string>|<key>CFBundleShortVersionString</key><string>$${VERSION_STR}</string>|" Info.plist &&\
|
||||
sed -i "s|ENV VERSION=.*|ENV VERSION=v$${TAG}|g" docker/Dockerfile && \
|
||||
git add Info.plist docker/Dockerfile && \
|
||||
git commit -m "release: version $${TAG}" && \
|
||||
echo "creating git tag : v$${TAG}" && \
|
||||
git push && \
|
||||
git tag v$${TAG} && \
|
||||
git push -u origin HEAD --tags && \
|
||||
echo "Github Actions will detect the new tag and release the new version."'
|
||||
release: # Create a new tag for release.
|
||||
@bash -c '.github/change_version.sh'
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ var commandExtension = &cobra.Command{
|
||||
}
|
||||
|
||||
func StartExtension() {
|
||||
v2.Setup("./tmp", "./", "./tmp", 0, false)
|
||||
grpc_server, _ := v2.StartCoreGrpcServer("127.0.0.1:12345")
|
||||
fmt.Printf("Waiting for CTRL+C to stop\n")
|
||||
runWebserver(grpc_server)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/bepass-org/warp-plus/warp"
|
||||
"github.com/hiddify/hiddify-core/common"
|
||||
"github.com/hiddify/hiddify-core/v2/common"
|
||||
C "github.com/sagernet/sing-box/constant"
|
||||
|
||||
// "github.com/bepass-org/wireguard-go/warp"
|
||||
|
||||
@@ -27,7 +27,6 @@ func setupOnce(api unsafe.Pointer) {
|
||||
//export setup
|
||||
func setup(baseDir *C.char, workingDir *C.char, tempDir *C.char, statusPort C.longlong, debug bool) (CErr *C.char) {
|
||||
err := v2.Setup(C.GoString(baseDir), C.GoString(workingDir), C.GoString(tempDir), int64(statusPort), debug)
|
||||
|
||||
return emptyOrErrorC(err)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package extension
|
||||
|
||||
import (
|
||||
"github.com/hiddify/hiddify-core/common"
|
||||
"github.com/hiddify/hiddify-core/config"
|
||||
"github.com/hiddify/hiddify-core/extension/ui"
|
||||
pb "github.com/hiddify/hiddify-core/hiddifyrpc"
|
||||
"github.com/hiddify/hiddify-core/v2/common"
|
||||
"github.com/jellydator/validation"
|
||||
"github.com/sagernet/sing-box/log"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/hiddify/hiddify-core/common"
|
||||
pb "github.com/hiddify/hiddify-core/hiddifyrpc"
|
||||
"github.com/hiddify/hiddify-core/v2/common"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/hiddify/hiddify-core/common"
|
||||
"github.com/hiddify/hiddify-core/v2/common"
|
||||
"github.com/hiddify/hiddify-core/v2/service_manager"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -26,11 +27,7 @@ func RegisterExtension(factory ExtensionFactory) error {
|
||||
return err
|
||||
}
|
||||
allExtensionsMap[factory.Id] = factory
|
||||
common.Storage.GetExtensionData("default", &generalExtensionData)
|
||||
|
||||
if val, ok := generalExtensionData.ExtensionStatusMap[factory.Id]; ok && val {
|
||||
loadExtension(factory)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -43,3 +40,31 @@ func loadExtension(factory ExtensionFactory) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type extensionService struct {
|
||||
// Storage *CacheFile
|
||||
}
|
||||
|
||||
func (s *extensionService) Start() error {
|
||||
common.Storage.GetExtensionData("default", &generalExtensionData)
|
||||
|
||||
for id, factory := range allExtensionsMap {
|
||||
if val, ok := generalExtensionData.ExtensionStatusMap[id]; ok && val {
|
||||
loadExtension(factory)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *extensionService) Close() error {
|
||||
for _, extension := range enabledExtensionsMap {
|
||||
if err := (*extension).Stop(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
service_manager.Register(&extensionService{})
|
||||
}
|
||||
|
||||
2
go.mod
2
go.mod
@@ -7,7 +7,7 @@ toolchain go1.22.3
|
||||
require (
|
||||
github.com/bepass-org/warp-plus v1.2.4
|
||||
github.com/fatih/color v1.16.0 // indirect
|
||||
github.com/hiddify/hiddify-ip-scanner-extension v0.0.0-20240928194626-7f6dde034dfe
|
||||
github.com/hiddify/hiddify-ip-scanner-extension v0.0.0-20240929171529-e72be5930514
|
||||
github.com/improbable-eng/grpc-web v0.15.0
|
||||
github.com/jellydator/validation v1.1.0
|
||||
github.com/kardianos/service v1.2.2
|
||||
|
||||
4
go.sum
4
go.sum
@@ -239,8 +239,8 @@ github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE
|
||||
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
|
||||
github.com/hiddify/hiddify-app-demo-extension v0.0.0-20240929132536-e158b83e958c h1:DHMeFSoah61yZQKWhQGK6V8ve6KzoiPn1tdK/kpY5Wc=
|
||||
github.com/hiddify/hiddify-app-demo-extension v0.0.0-20240929132536-e158b83e958c/go.mod h1:a/gJxWYZWt5ii9sDObSERSmxVEUVtsR8ZMnbgN8tLCM=
|
||||
github.com/hiddify/hiddify-ip-scanner-extension v0.0.0-20240928194626-7f6dde034dfe h1:lqlc/H76XSDdOlwboI77pdDZGTwzNh6/J0MaYGOYUAc=
|
||||
github.com/hiddify/hiddify-ip-scanner-extension v0.0.0-20240928194626-7f6dde034dfe/go.mod h1:9Fjoaxn2gbFQioxwdb06Kaz4kfFV7nxS0TJ/+IlDWvg=
|
||||
github.com/hiddify/hiddify-ip-scanner-extension v0.0.0-20240929171529-e72be5930514 h1:22nmdhhrCUW5ygzSIIs6KlCndJGmNUb7+43i71M5nHg=
|
||||
github.com/hiddify/hiddify-ip-scanner-extension v0.0.0-20240929171529-e72be5930514/go.mod h1:9Fjoaxn2gbFQioxwdb06Kaz4kfFV7nxS0TJ/+IlDWvg=
|
||||
github.com/hiddify/hiddify-sing-box v1.8.9-0.20240928213625-7b79bf0c814d h1:+jTGlmOl+Kt3JEU1pt5yIItpi6nKKqUIUf76jkONHgQ=
|
||||
github.com/hiddify/hiddify-sing-box v1.8.9-0.20240928213625-7b79bf0c814d/go.mod h1:2Cozqb5uVY/y0c/HWZ57CfE6fZwjmik/J3tWynsjjDA=
|
||||
github.com/hiddify/ray2sing v0.0.0-20240928221833-190b549d5222 h1:+MFxFxoWCA44WhqIixqL/Zkt4DwnqhQvafS0Dm4+dKM=
|
||||
|
||||
@@ -7,13 +7,15 @@ import (
|
||||
|
||||
"github.com/hiddify/hiddify-core/config"
|
||||
|
||||
"github.com/hiddify/hiddify-core/v2"
|
||||
|
||||
_ "github.com/sagernet/gomobile"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
)
|
||||
|
||||
func Setup() error {
|
||||
func Setup(baseDir string, workingDir string, tempDir string, debug bool) error {
|
||||
return v2.Setup(baseDir, workingDir, tempDir, 0, debug)
|
||||
// return v2.Start(17078)
|
||||
return nil
|
||||
}
|
||||
|
||||
func Parse(path string, tempPath string, debug bool) error {
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/hiddify/hiddify-core/v2/service_manager"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
|
||||
"github.com/sagernet/bbolt"
|
||||
@@ -19,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
Storage = New(context.Background(), option.CacheFileOptions{})
|
||||
Storage CacheFile
|
||||
bucketExtension = []byte("extension")
|
||||
bucketHiddify = []byte("hiddify")
|
||||
|
||||
@@ -29,6 +30,24 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
type StorageService struct {
|
||||
// Storage *CacheFile
|
||||
}
|
||||
|
||||
func (s *StorageService) Start() error {
|
||||
Storage = *NewStorage(context.Background(), option.CacheFileOptions{})
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *StorageService) Close() error {
|
||||
Storage.DB.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
service_manager.RegisterPreservice(&StorageService{})
|
||||
}
|
||||
|
||||
type CacheFile struct {
|
||||
ctx context.Context
|
||||
path string
|
||||
@@ -37,7 +56,7 @@ type CacheFile struct {
|
||||
DB *bbolt.DB
|
||||
}
|
||||
|
||||
func New(ctx context.Context, options option.CacheFileOptions) *CacheFile {
|
||||
func NewStorage(ctx context.Context, options option.CacheFileOptions) *CacheFile {
|
||||
var path string
|
||||
if options.Path != "" {
|
||||
path = options.Path
|
||||
@@ -35,7 +35,6 @@ func StartGrpcServer(listenAddressG string, service string) (*grpc.Server, error
|
||||
if service == "core" {
|
||||
|
||||
// Setup("./tmp/", "./tmp", "./tmp", 11111, false)
|
||||
Setup("./tmp", "./", "./tmp", 0, false)
|
||||
|
||||
useFlutterBridge = false
|
||||
pb.RegisterCoreServer(s, &CoreService{})
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
runtimeDebug "runtime/debug"
|
||||
"time"
|
||||
|
||||
"github.com/hiddify/hiddify-core/v2/service_manager"
|
||||
|
||||
B "github.com/sagernet/sing-box"
|
||||
"github.com/sagernet/sing-box/common/urltest"
|
||||
"github.com/sagernet/sing-box/experimental/libbox"
|
||||
@@ -27,9 +29,13 @@ var (
|
||||
statusPropagationPort int64
|
||||
)
|
||||
|
||||
func InitHiddifyService() error {
|
||||
return service_manager.StartServices()
|
||||
}
|
||||
|
||||
func Setup(basePath string, workingPath string, tempPath string, statusPort int64, debug bool) error {
|
||||
statusPropagationPort = int64(statusPort)
|
||||
tcpConn := runtime.GOOS == "windows" //TODO add TVOS
|
||||
tcpConn := runtime.GOOS == "windows" // TODO add TVOS
|
||||
libbox.Setup(basePath, workingPath, tempPath, tcpConn)
|
||||
sWorkingPath = workingPath
|
||||
os.Chdir(sWorkingPath)
|
||||
@@ -53,7 +59,11 @@ func Setup(basePath string, workingPath string, tempPath string, statusPort int6
|
||||
// },
|
||||
})
|
||||
coreLogFactory = factory
|
||||
return err
|
||||
|
||||
if err != nil {
|
||||
return E.Cause(err, "create logger")
|
||||
}
|
||||
return InitHiddifyService()
|
||||
}
|
||||
|
||||
func NewService(options option.Options) (*libbox.BoxService, error) {
|
||||
|
||||
46
v2/service_manager/hiddify.go
Normal file
46
v2/service_manager/hiddify.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package service_manager
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/adapter"
|
||||
)
|
||||
|
||||
var (
|
||||
services = []adapter.Service{}
|
||||
preservices = []adapter.Service{}
|
||||
)
|
||||
|
||||
func RegisterPreservice(service adapter.Service) {
|
||||
preservices = append(services, service)
|
||||
}
|
||||
|
||||
func Register(service adapter.Service) {
|
||||
services = append(services, service)
|
||||
}
|
||||
|
||||
func StartServices() error {
|
||||
for _, service := range preservices {
|
||||
if err := service.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
for _, service := range services {
|
||||
if err := service.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func CloseServices() error {
|
||||
for _, service := range services {
|
||||
if err := service.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
for _, service := range preservices {
|
||||
if err := service.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user