127.0.0.1:9801 on the local machine.root (required for operations involving policy-based routing, iptables, and tun devices).dataKey (device key) obtained from the Tencent Cloud console.MP_SDK_V1.0R002_<commit>_<arch>.BIN
chmod +x MP_SDK_V1.0R002_xxxx_x86_64.BIN./MP_SDK_V1.0R002_xxxx_x86_64.BIN
Path | Description |
/usr/local/bin/mp-sdk/mp-sdk | SDK main program (HTTP service) |
/usr/local/bin/mp-speeder/mp-speeder | Accelerate processes |
/usr/local/etc/mp-speeder/mp_client_ifname.conf | Network interface configuration file |
/usr/local/etc/mp-speeder/data/mp_client.json | Acceleration parameter configuration file |
# Check whether the SDK process is runningps -ef | grep mp-sdk | grep -v grep
eth0).echo '{"ifName":"eth0"}' > /usr/local/etc/mp-speeder/mp_client_ifname.conf

Function | Methodology | Path |
Enable policy-based routing. | POST | /api/v2/route/policyRouteManagement |
Configure acceleration parameters. | POST | /api/v2/client/mp-speeder |
Add business traffic steering. | POST | /api/v2/route/businessRoute |
Add multi-mode rules (Optional). | POST | /api/v2/client/multi-mode |
Start acceleration. | POST | /api/v2/client/mp-speeder/start |
Query acceleration status. | GET | /api/v2/client/mp-speeder |
Stop acceleration. | POST | /api/v2/client/mp-speeder/stop |
Restart acceleration. | POST | /api/v2/client/mp-speeder/restart |
scheduleMode field during Step 2, "Configure Acceleration Parameters" (bonding / redundant / rtc). This corresponds to Step 2.bonding aggregation, while mission-critical services that require high reliability use redundant dual-send.
enable: true (set to false to disable it).dataKey, network interfaces participating in acceleration, and scheduling modes. These parameters are persisted to /usr/local/etc/mp-speeder/data/mp_client.json. Here, scheduleMode is the default mode.Field | Type | Required | Description |
dataKey | string | Yes | Device key obtained from the console |
interfaces | [string] | Yes | List of network interfaces participating in acceleration, for example, ["eth0","eth1"] |
scheduleMode | string | No | Default mode: bonding / redundant / rtc. The default is bonding. It serves as the fallback forwarding mode. |
Field | Example | Description |
srcIP | 192.168.1.0/24 | Source address segment, optional. |
dstIP | 10.0.0.0/24 | Destination address segment |
protocol | TCP / UDP | Protocol |
srcPorts | 0-65535 | Source port range, optional |
dstPorts | 443 or 8000-9000 | Target port |
speedMode (0=default / 1=direct / 2=bonding / 3=rtc / 4=redundant). The other quintuple fields are the same as described above.ready == true, which indicates that the acceleration tunnel has been established.POST /api/v2/client/mp-speeder/startPOST /api/v2/client/mp-speeder/stopPOST /api/v2/client/mp-speeder/restartdataKey, adjusting network interfaces, or modifying service traffic steering rules), you need to call the restart acceleration API to make the new configuration take effect.POST /api/v2/client/mp-speeder/stop) once. Then, proceed with the configuration steps normally. Finally, call the start acceleration API.POST /api/v2/client/mp-speeder/restart) to make the new configuration take effect.quick_start.sh. Modify variables such as DATA_KEY as needed, and then execute it:#!/bin/bash# Linux SDK One-Click Integration Exampleset -uSDK="http://127.0.0.1:9801/api/v2"# ==== Modify the following variables according to your actual situation ====DATA_KEY="PUT_YOUR_DATA_KEY_HERE"ACC_IFS='["eth0","eth1"]' # List of network interfaces participating in accelerationSRC_CIDR="0.0.0.0/0"DST_CIDR="10.0.0.0/24"DST_PORTS="443"PROTO="TCP"# =============================# Check whether the user has forgotten to modify DATA_KEY[ "$DATA_KEY" = "PUT_YOUR_DATA_KEY_HERE" ] && { echo "Please modify the DATA_KEY variable to the actual dataKey first"; exit 1; }echo "[1/6] Enabling policy-based routing"curl -s -X POST "$SDK/route/policyRouteManagment" -H "enable: true"echoecho "[2/6] Configuring acceleration parameters"curl -s -X POST "$SDK/client/mp-speeder" \\-H "Content-Type: application/json" \\-d "{\\"dataKey\\": \\"$DATA_KEY\\",\\"interfaces\\": $ACC_IFS,\\"scheduleMode\\": \\"bonding\\"}"echoecho "[3/6] Adding business traffic steering"curl -s -X POST "$SDK/route/businessRoute" \\-H "all: false" \\-H "Content-Type: application/json" \\-d "[{\\"srcIP\\": \\"$SRC_CIDR\\",\\"dstIP\\": \\"$DST_CIDR\\",\\"protocol\\": \\"$PROTO\\",\\"dstPorts\\": \\"$DST_PORTS\\"}]"echo# Step 4 (Optional, use only when scheduling in a specific mode is required)# curl -s -X POST "$SDK/client/multi-mode" \\# -H "Content-Type: application/json" \\# -d '{"dstIP":"10.0.0.0/24","protocol":"TCP","dstPorts":"443","speedMode":2,"priority":100}'echo "[5/6] Restarting acceleration (to apply the new configuration)"curl -s -X POST "$SDK/client/mp-speeder/restart"echoecho "[6/6] Querying acceleration status (wait up to 30 seconds)"for i in $(seq 1 30); doready=$(curl -s "$SDK/client/mp-speeder" | grep -o '"ready":[^,}]*' | awk -F: '{print $2}' | tr -d ' ')if [ "$ready" = "true" ]; thenecho "Acceleration is ready"exit 0fisleep 1doneecho "Acceleration is not ready within 30 seconds"exit 1
curl -s -X POST "http://127.0.0.1:9801/api/v2/client/mp-speeder/stop"
main.go and execute it using go run main.go (it relies only on the standard library):package mainimport ("bytes""encoding/json""fmt""io""log""net/http""os""time")const sdkBase = "http://127.0.0.1:9801/api/v2"// General HTTP callfunc call(method, path string, headers map[string]string, body interface{}) ([]byte, error) {var reqBody io.Readerif body != nil {bs, _ := json.Marshal(body)reqBody = bytes.NewReader(bs)}req, err := http.NewRequest(method, sdkBase+path, reqBody)if err != nil {return nil, err}if body != nil {req.Header.Set("Content-Type", "application/json")}for k, v := range headers {req.Header.Set(k, v)}resp, err := http.DefaultClient.Do(req)if err != nil {return nil, err}defer resp.Body.Close()respBody, _ := io.ReadAll(resp.Body)if resp.StatusCode >= 400 {return respBody, fmt.Errorf("status=%d body=%s", resp.StatusCode, string(respBody))}return respBody, nil}func main() {// Simplified log format: retains only the timestamp, omitting the filename prefixlog.SetFlags(log.LstdFlags)// ==== Modify according to your actual situation ====dataKey := "PUT_YOUR_DATA_KEY_HERE"accIfs := []string{"eth1"}// =====================// Check whether the user has forgotten to modify dataKeyif dataKey == "PUT_YOUR_DATA_KEY_HERE" {log.Fatal("Please modify the dataKey variable to the actual dataKey first")}// 1. Enable policy-based routinglog.Println("[1/6] Enabling policy-based routing ...")_, err := call("POST", "/route/policyRouteManagment",map[string]string{"enable": "true"}, nil)if err != nil {log.Fatalf("Failed to enable policy-based routing: %v", err)}// 2. Configure acceleration parameterslog.Println("[2/6] Configuring acceleration parameters ...")accCfg := map[string]interface{}{"dataKey": dataKey,"interfaces": accIfs,"scheduleMode": "bonding",}_, err = call("POST", "/client/mp-speeder", nil, accCfg)if err != nil {log.Fatalf("Failed to configure acceleration parameters: %v", err)}// 3. Add business traffic steeringlog.Println("[3/6] Adding business traffic steering ...")routes := []map[string]string{{"srcIP": "0.0.0.0/0","dstIP": "10.0.0.0/24","protocol": "TCP","dstPorts": "443",},}_, err = call("POST", "/route/businessRoute",map[string]string{"all": "false"}, routes)if err != nil {log.Fatalf("Failed to add business traffic steering: %v", err)}// 4. (Optional) Add multi-mode rules// modeRule := map[string]interface{}{// "dstIP": "10.0.0.0/24",// "protocol": "TCP",// "dstPorts": "443",// "speedMode": 2,// "priority": 100,// }// call("POST", "/client/multi-mode", nil, modeRule)// 5. Restart acceleration (to apply the new configuration)log.Println("[5/6] Restarting acceleration ...")_, err = call("POST", "/client/mp-speeder/restart", nil, nil)if err != nil {log.Fatalf("Failed to restart acceleration: %v", err)}// 6. Poll acceleration statuslog.Println("[6/6] Waiting for acceleration to be ready (up to 30 seconds) ...")type status struct {Ready bool `json:"ready"`}const maxWait = 30for i := 1; i <= maxWait; i++ {body, err := call("GET", "/client/mp-speeder", nil, nil)if err == nil {var s statusif json.Unmarshal(body, &s) == nil && s.Ready {log.Printf("Acceleration is ready (took %ds)", i)return}}time.Sleep(time.Second)}log.Println("Acceleration is not ready within 30 seconds")os.Exit(1)}
call("POST", "/client/mp-speeder/stop", nil, nil)
curl --interface mp_tun0 https://www.qq.com
iptables -t mangle -nvL
ready remains false after the call is initiated?iptables -t mangle -nvL to observe whether the hit count for the corresponding rules is increasing./usr/local/etc/mp-speeder/ and will be loaded automatically after the SDK starts.Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback