FoxiGram/TMessagesProj/jni/boringssl/util/check_imported_libraries.go
instant992 8e79f2ee9c FoxiGram: Telegram client with built-in Xray VLESS proxy
Based on Nekogram. Key additions:
- Rebrand to FoxiGram (app name, APK name, applicationId com.foxigram.app)
- Embedded Xray (VLESS+Reality) proxy client via JNI libxray.so
- Bundled hidden one-tap proxies (LTE + WiFi), read-only in UI
- Auto-restore proxy on restart, rebind to active network (LTE/WiFi)
- Server credentials externalized to git-ignored XrayServers.java (+ template)
- libxray Go source included; compiled .so, keystore, google-services.json ignored
2026-06-08 16:41:07 +04:00

71 lines
1.7 KiB
Go

// Copyright 2017 The BoringSSL Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build ignore
// check_imported_libraries.go checks that each of its arguments only imports
// allowed libraries. This is used to avoid accidental dependencies on
// libstdc++.so.
package main
import (
"debug/elf"
"fmt"
"os"
"path/filepath"
)
func checkImportedLibraries(path string) bool {
file, err := elf.Open(path)
if err != nil {
fmt.Fprintf(os.Stderr, "Error opening %s: %s\n", path, err)
return false
}
defer file.Close()
libs, err := file.ImportedLibraries()
if err != nil {
fmt.Fprintf(os.Stderr, "Error reading %s: %s\n", path, err)
return false
}
allowCpp := filepath.Base(path) == "libssl.so"
for _, lib := range libs {
if lib == "libc.so.6" || lib == "libcrypto.so" || lib == "libpthread.so.0" || lib == "libgcc_s.so.1" {
continue
}
if allowCpp && lib == "libstdc++.so.6" {
continue
}
fmt.Printf("Invalid dependency for %s: %s\n", path, lib)
fmt.Printf("All dependencies:\n")
for _, lib := range libs {
fmt.Printf(" %s\n", lib)
}
return false
}
return true
}
func main() {
ok := true
for _, path := range os.Args[1:] {
if !checkImportedLibraries(path) {
ok = false
}
}
if !ok {
os.Exit(1)
}
}