
// InitSDK Initialize SDK// Parameter:// - disableLogEncrypt: want to close log encryption, 1 means disabling log encryption, 0 means enable log encryption// Return: 0 indicates successful initialization (reentrant), -1 indicates failureint InitSDK(int disableLogEncrypt);
// StartSDK Start the SDK service// Return: 0 indicates successful startup (reentrant), -1 indicates startup failure, -2 indicates the SDK is uninitializedint StartSDK();
// StopSDK Stop the SDK service// Return: 0 indicates stopped successfully, -1 indicates the SDK is not startedint StopSDK();
// IsSDKRunning Check whether the SDK is running// Return: 1 means running, 0 means not runningint IsSDKRunning();
api | Description |
/api/v2/client/mp-speeder | Configure acceleration parameters |
/api/v2/client/mp-speeder/start | Start acceleration |
/api/v2/client/mp-speeder/stop | Stop acceleration |
/api/v2/client/mp-speeder/restart | Restart acceleration |
/api/v2/client/mp-speeder | Query acceleration status |
/api/v2/client/flowStatistics | Query acceleration traffic information |
/api/v2/client/multi-mode | Configure flow forwarding policy |
/api/v2/diagnosis/log | Log Reporting |
/api/v2/client/t2Statistics | Query drop-off point speed test information |
curl -X POST "http://127.0.0.1:9801/api/v2/client/mp-speeder" ^-H "accept: */*" ^-H "Content-Type: application/json" ^-d "{\\"serviceMode\\":0,\\"dataKey\\":\\"xxxxxxx\\",\\"scheduleMode\\":\\"rtc\\",\\"registerEnv\\":-2,\\"tunInterfaceName\\":\\"mp_tun0\\",\\"t2Probe\\":true}"
curl -X POST "http://127.0.0.1:9801/api/v2/client/mp-speeder" ^-H "accept: */*" ^-H "Content-Type: application/json" ^-d "{\\"serviceMode\\": 0,\\"appId\\":\\"app-0eoo3vpctx\\",\\"appSign\\":\\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkZXZpY2VOYW1lIjoiamFja3ktdGVzdC0yMC0xIn0.TleKYrzBL1dyp2i8WTBgs8Y8UvBJQv-n2A2BRMT1xuQ\\",\\"scheduleMode\\":\\"rtc\\"}"
curl -X POST "http://127.0.0.1:9801/api/v2/client/mp-speeder" ^-H "accept: */*" ^-H "Content-Type: application/json" ^-d "{\\"serviceMode\\": 0,\\"gwId\\":\\"mpgw-n96i24ugbd\\",\\"appId\\":\\"zone-359h792djt7h\\",\\"appSign\\":\\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkZXZpY2VOYW1lIjoiamFja3ktdGVzdC0yMC0xIn0.RWGNKp_DXqnrg7SJ2yR5UV_MDs3_KWDccBURQfBfiYg\\",\\"scheduleMode\\":\\"rtc\\",\\"enableEoSch\\":true}"
Name | Type | Description |
dataKey | string | Required: The device dataKey for the activation mode selected from the three options above. |
vendor | string | Required: The device vendor and model for the activation mode selected from the three options above. |
sn | string | Required: The unique device serial number provided by the device vendor when one of the three activation modes mentioned above is selected. |
appId | string | Optional: Used when the app mode + eo mode is selected from the three activation modes mentioned above. Fill in the corresponding zoneId in eo mode. |
appSign | string | Optional: Used when the app mode + eo mode is selected from the three activation modes mentioned above. |
enableEoSch | boolean | Optional: Must be true in eo mode. |
gwId | string | Optional: Used in eo mode. Fill in the corresponding gatewayId. |
lineType | [int] | Optional: Used when specified lines are enabled in eo mode. 0: Direct connection. 1:eo. 2: Third-party. |
enableObfuscated | string | Optional: Whether to enable the IP address obfuscation feature. |
encryptSign | string | Optional: Required when IP address obfuscation is enabled. Used for encrypting and decrypting IP addresses. Must match the sign used for IP address encryption on the client side. appSign is recommended. For the encryption algorithm, see the appendix. |
scheduleMode | string | Optional: The default acceleration mode for Windows, "rtc". |
accGateway | string | Optional: Specify the acceleration gateway IP address. Multiple IP addresses should be separated by commas. If this parameter is not specified, the SDK will automatically connect to the nearest gateway. Otherwise, it will forcibly connect to the specified acceleration gateway, for example: "120.30.39.129". |
gwPort | string | Optional. The gateway port. Default: "443". |
UUID | string | Optional: The hardware fingerprint. If this parameter is not specified, the SDK will automatically generate it based on the hardware. |
disableCrypto | integer | Optional: Allows the customer to choose whether to enable encryption when starting acceleration. Traffic encryption is enabled by default. Disabling encryption can reduce traffic consumption. 0: Enable traffic encryption (default). 1: Disable traffic encryption. |
flowStatisticsInterval | integer | Optional: The frequency for link acceleration traffic statistics. Default: 3 seconds. |
maxRttDisableAggregation | integer | Optional: The maximum latency for link aggregation. Default: 460 ms. |
maxRttThreshold | integer | Optional: The latency for initiating link failure detection. Default: 460 ms. |
minSwitchRTT | integer | Optional: The sensitivity for fast link switching. Default: 20 ms. |
maxDelayUntilFailed | integer | Optional: The maximum latency for link switching. Default: 460 ms. |
registerEnv | integer | Optional: The cloud acceleration gateway cluster environment to which the SDK connects. (For testing only.) 0: Production environment (default). 1: Production environment (International site). -2: Customer experience environment (POC test environment). |
t2Probe | boolean | Optional: true: enables t2 speed measurement; false: disables t2 speed measurement. |
authCode | string | Optional: Enabling traffic-free access. |
curl -X POST "http://127.0.0.1:9801/api/v2/client/socks5" ^-H "accept: application/json" ^-H "Content-Type: application/json" ^-d "{\\"enable\\": true, \\"port\\": 12345, \\"userName\\": \\"xxxxx\\", \\"passWord\\": \\"xxxxx\\"}"
Name | Type | Description |
enable | bool | Required: Whether to customize the socks5 server. |
port | int | Required: socks5 server port. |
userName | string | Required: socks5 server username. |
passWord | string | Required: socks5 server password. |
curl -X GET "http://127.0.0.1:9801/api/v2/client/socks5" ^-H "accept: application/json" ^-H "Content-Type: application/json"
curl -X POST "http://127.0.0.1:9801/api/v2/client/mp-speeder/start" -H "accept: */*" -H "Content-Type: application/json"
curl -X POST "http://127.0.0.1:9801/api/v2/client/mp-speeder/stop" -H "accept: */*" -H "Content-Type: application/json"
curl -X POST "http://127.0.0.1:9801/api/v2/client/mp-speeder/restart" -H "accept: */*" -H "Content-Type: application/json"
curl -X GET "http://127.0.0.1:9801/api/v2/client/mp-speeder" -H "accept: */*" -H "Content-Type: application/json"
Name | Type | Description |
ready | boolean | Whether the acceleration process is started normally. |
UUID | string | The hardware fingerprint of the device. |
dataKey | string | The device dataKey. |
swVersion | string | The sdk software version. |
accGateway | string | The IP address of the acceleration gateway. |
gatewayPort | string | The port of the acceleration gateway. |
interfaces | [string] | The list of interfaces participating in multi-link aggregation. |
scheduleMode | string | The default acceleration mode. "bonding", "redundant", "rtc". |
registerEnv | integer | The cloud acceleration gateway cluster environment to which the sdk connects. 0: Production environment (default). 1: Production environment (International site). -2: Customer experience environment (POC test environment). |
curl -X GET "http://127.0.0.1:9801/api/v2/client/flowStatistics" -H "accept: application/json" -H "all: true"
Name | Type | Description |
interface | string | Name of the link NIC. |
state | integer | Current link operational status: -2: Link unavailable. 60: Link temporarily disabled. 100: Link normal. |
totalReceivedBytes | integer | Cumulative accelerated traffic in the receive direction, in Bytes. |
totalSendBytes | integer | Cumulative accelerated traffic in the send direction, in Bytes. |
receivedRate | float | Receive rate of the current NIC acceleration channel, in bit/s. |
sendRate | float | Send rate of the current NIC acceleration channel, in bit/s. |
loss | float | Packet loss rate of the current NIC acceleration channel. The packet loss rate is expressed as a decimal, for example, 0.1 indicates a packet loss rate of 10%, and 1 indicates a packet loss rate of 100%. |
rtt | integer | rtt of the current NIC acceleration channel, in ms. Note: -1 indicates that the current link is unavailable. |
curl -X GET "http://127.0.0.1:9801/api/v2/client/t2Statistics" -H "accept: application/json" -H "all: true"
Name | Type | Description |
area | string | Name of the drop-off point. |
rttAccelerated | int | Latency from the sdk to the drop-off point. |
rttDirect | int | Latency for the sdk directly connecting to the drop-off point. |
curl -X POST "http://127.0.0.1:9801/api/v2/client/multi-mode" ^-H "accept: application/json" ^-H "Content-Type: application/json" ^-d "{\\"area\\": \\"hongkong\\",\\"speedMode\\": 35}"
Name | Type | Description |
appId | string | Optional: Accelerates traffic based on the specified appId rule. |
area | string | auto: Automatically selects a drop-off point based on the region to which the dip belongs. Frankfurt: Frankfurt. SiliconValley: United States - Silicon Valley. SaoPaulo: Brazil - Sao Paulo. Tokyo: Japan. Bangkok: Thailand (Southeast Asia Server). Singapore: Singapore. HongKong: Hong Kong (China). Seoul: Seoul, South Korea. |
speedMode | integer | 0 - "DEFAULT": Reuses the default acceleration mode. 1 - "DIRECT": No acceleration; traffic uses the system's default network card. 2 - "bonding": Aggregation mode. 3 - "rtc": Real-time audio and video mode. 4 - "redundant": Multi-send selective-receive mode. 25 - (Reserved configuration). 35 - "T2 rtc": First performs rtc fast switching, then performs T2 full-path acceleration. 45 - (Reserved configuration). |
curl -X POST "http://127.0.0.1:9801/api/v2/client/enableCMCCRightsVerify" ^-H "accept: application/json" ^-H "Content-Type: application/json" ^-d "{\\"token\\": \\"xxxxx\\"}"
Name | Type | Description |
token | string | Required: Used to verify the token. |
guid | string | Required: Used to verify the guid, and must be used together with the token. |
salt | string | Required: The salt value, used for encryption. |
Name | Type | Description |
status | bool | Required: Whether the token is authenticated successfully. |
authCode | string | Optional: Returns the traffic-free authentication code if the verification succeeds. |
error | string | Optional: Returns an error via the error field when the verification fails. |
curl -X POST "http://127.0.0.1:9801/api/v2/diagnosis/log" ^-H "accept: application/json" ^-H "Content-Type: application/json" ^-d "{\\"logLevel\\": \\"debug\\", \\"upload\\": false, \\"uploadInterval\\": 10}"
Name | Type | Description |
logLevel | string | Optional: The program log level. Defaults to "info". Supports configuration of "info", "debug", and "warn". |
autoUpload | boolean | Optional: The automatic upload switch. Defaults to false. When set to true, logs are automatically uploaded. |
uploadInterval | integer | Optional: The automatic upload interval. Defaults to 10 minutes. Does not take effect when automatic upload is not enabled. |
curl -X POST "http://127.0.0.1:9801/api/v2/diagnosis/log"
using System;using System.Runtime.InteropServices;using System.Threading;class Program{[DllImport("linkboost.dll", CallingConvention = CallingConvention.Cdecl)]static extern int InitSDK(int disableLogEncrypt);[DllImport("linkboost.dll", CallingConvention = CallingConvention.Cdecl)]static extern int StartSDK();[DllImport("linkboost.dll", CallingConvention = CallingConvention.Cdecl)]static extern int StopSDK();[DllImport("linkboost.dll", CallingConvention = CallingConvention.Cdecl)]static extern int IsSDKRunning();private static bool keepRunning = true;static void Main(){// Register Ctrl+C event handlingConsole.CancelKeyPress += (sender, e) =>{e.Cancel = true; // prevent exit immediatelykeepRunning = false;Console.WriteLine("\\nPausing program...");};try{Console.WriteLine("Initializing SDK...");// Initialize sdk, unencrypted logsInitSDK(1);Console.WriteLine("Starting SDK...");// Start the sdkStartSDK();Console.WriteLine($"SDK Running: {IsSDKRunning()}");Console.WriteLine("\\nSDK started, program will continuously run");Console.WriteLine("Press Ctrl+C to manually end the program\\n");// Continuously run until Ctrl+C is pressedwhile (keepRunning){Thread.Sleep(1000); // Check once per second}}finally{Console.WriteLine("Pausing SDK...");Stop the sdkStopSDK();Console.WriteLine("SDK stopped, program exit");}}}
curl -X POST "http://127.0.0.1:9801/api/v2/client/mp-speeder/start" -H "accept: */*" -H "Content-Type: application/json"
import jwtfrom datetime import datetime, timedeltafrom typing import Tupleclass JWTGenerator:EXPIRE_HOURS = 72 # Expiration time, in hoursSECRET_KEY = "shCrVLKq/Hp6UdtVpw8lBqu6ZDcLwOABf2Az67e/pjI=" # APP key@classmethoddef generate_sign(cls, device_name: str) -> Tuple[str, int]:Generate JWT signaturenow = datetime.utcnow()expire_time = now + timedelta(hours=cls.EXPIRE_HOURS)payload = {"nbf": now,"exp": expire_time,"deviceName": device_name}token = jwt.encode(payload,cls.SECRET_KEY,algorithm="HS256")return token, int(expire_time.timestamp())if __name__ == "__main__":try:sign, expire_ts = JWTGenerator.generate_sign("tencent-test")print(f"Signature: {sign}")print(f"Expire Time: {expire_ts}")except Exception as e:print(f"Error generating token: {str(e)}")
package mainimport ("fmt""github.com/dgrijalva/jwt-go/v4""time")func main() {sign, expireTime, err := GenerateSign("tencent-test")if err != nil {panic(err)}println(sign, expireTime)}// SignClaims JwtCustomClaimstype SignClaims struct {jwt.StandardClaimsDeviceName string `json:"deviceName"`}var (ExpireTime = 72 // Expiration time, in hoursSecretKey = []byte("shCrVLKq/Hp6UdtVpw8lBqu6ZDcLwOABf2Az67e/pjI=") // APP key)// GenerateSign generate signaturefunc GenerateSign(deviceName string) (string, int64, error) {expireTime := time.Now().Add(time.Duration(ExpireTime) * time.Hour)claims := &SignClaims{StandardClaims: jwt.StandardClaims{NotBefore: jwt.Now(),ExpiresAt: jwt.At(expireTime),},DeviceName: deviceName,}println(fmt.Sprintf("%#v", claims))token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)sign, err := token.SignedString(SecretKey)if err != nil {return "", 0, err}return sign, expireTime.Unix(), nil}
package org.example;import io.jsonwebtoken.Jwts;import io.jsonwebtoken.SignatureAlgorithm;import java.security.Key;import java.util.Date;import javax.crypto.spec.SecretKeySpec;/*** generate sign*/public class SignGenerate {private static final long EXPIRE_TIME = 72 * 60 * 60 * 1000; // Expiration time, in millisecondsprivate static final String SECRET_KEY = "shCrVLKq/Hp6UdtVpw8lBqu6ZDcLwOABf2Az67e/pjI="; // APP keypublic static void main(String[] args) {String deviceName = "tencent-test";String sign = generateSign(deviceName);System.out.println(sign);}public static String generateSign(String deviceName) {Date now = new Date();Date expireDate = new Date(now.getTime() + EXPIRE_TIME);Key key = new SecretKeySpec(SECRET_KEY.getBytes(), SignatureAlgorithm.HS256.getJcaName());return Jwts.builder().claim("deviceName", deviceName).notBefore(now).expiration(expireDate).signWith(key).compact();}}
package mainimport ("crypto/sha256""fmt""golang.org/x/crypto/chacha20""net")func main(ip net.IP, psk []byte) ([]byte, error) {if ip.To4() == nil {return nil, fmt.Errorf("invalid ipv4 address")}key := sha256.Sum256(psk)encryptKey := key[:32]nonce := make([]byte, 12)cipher, err := chacha20.NewUnauthenticatedCipher(encryptKey, nonce)if err != nil {return nil, err}// In-place encryption (32bit exact output)ciphertext := make([]byte, net.IPv4len)cipher.XORKeyStream(ciphertext, ip.To4())return ciphertext, nil}
フィードバック