esp-idf-v5.1.1 空中升级OTA例程

2023-12-08 19:59
文章标签 升级 idf ota esp 例程 空中 v5.1

本文主要是介绍esp-idf-v5.1.1 空中升级OTA例程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

esp-idf-v5.1.1\examples\system\ota

首先需要准备一个python脚本建立本地服务器,使用http协议,

server_cert 和 server_key 为相对应的密钥。

# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0
import http.server
import multiprocessing
import os
import ssl
import sys
from typing import Tupleimport pexpect
import pytest
from common_test_methods import get_env_config_variable, get_host_ip4_by_dest_ip
from pytest_embedded import Dutserver_cert = '-----BEGIN CERTIFICATE-----\n' \'MIIDWDCCAkACCQCbF4+gVh/MLjANBgkqhkiG9w0BAQsFADBuMQswCQYDVQQGEwJJ\n'\'TjELMAkGA1UECAwCTUgxDDAKBgNVBAcMA1BVTjEMMAoGA1UECgwDRVNQMQwwCgYD\n'\'VQQLDANFU1AxDDAKBgNVBAMMA0VTUDEaMBgGCSqGSIb3DQEJARYLZXNwQGVzcC5j\n'\'b20wHhcNMjEwNzEyMTIzNjI3WhcNNDEwNzA3MTIzNjI3WjBuMQswCQYDVQQGEwJJ\n'\'TjELMAkGA1UECAwCTUgxDDAKBgNVBAcMA1BVTjEMMAoGA1UECgwDRVNQMQwwCgYD\n'\'VQQLDANFU1AxDDAKBgNVBAMMA0VTUDEaMBgGCSqGSIb3DQEJARYLZXNwQGVzcC5j\n'\'b20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDhxF/y7bygndxPwiWL\n'\'SwS9LY3uBMaJgup0ufNKVhx+FhGQOu44SghuJAaH3KkPUnt6SOM8jC97/yQuc32W\n'\'ukI7eBZoA12kargSnzdv5m5rZZpd+NznSSpoDArOAONKVlzr25A1+aZbix2mKRbQ\n'\'S5w9o1N2BriQuSzd8gL0Y0zEk3VkOWXEL+0yFUT144HnErnD+xnJtHe11yPO2fEz\n'\'YaGiilh0ddL26PXTugXMZN/8fRVHP50P2OG0SvFpC7vghlLp4VFM1/r3UJnvL6Oz\n'\'3ALc6dhxZEKQucqlpj8l1UegszQToopemtIj0qXTHw2+uUnkUyWIPjPC+wdOAoap\n'\'rFTRAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAItw24y565k3C/zENZlxyzto44ud\n'\'IYPQXN8Fa2pBlLe1zlSIyuaA/rWQ+i1daS8nPotkCbWZyf5N8DYaTE4B0OfvoUPk\n'\'B5uGDmbuk6akvlB5BGiYLfQjWHRsK9/4xjtIqN1H58yf3QNROuKsPAeywWS3Fn32\n'\'3//OpbWaClQePx6udRYMqAitKR+QxL7/BKZQsX+UyShuq8hjphvXvk0BW8ONzuw9\n'\'RcoORxM0FzySYjeQvm4LhzC/P3ZBhEq0xs55aL2a76SJhq5hJy7T/Xz6NFByvlrN\n'\'lFJJey33KFrAf5vnV9qcyWFIo7PYy2VsaaEjFeefr7q3sTFSMlJeadexW2Y=\n'\'-----END CERTIFICATE-----\n'server_key = '-----BEGIN PRIVATE KEY-----\n'\'MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDhxF/y7bygndxP\n'\'wiWLSwS9LY3uBMaJgup0ufNKVhx+FhGQOu44SghuJAaH3KkPUnt6SOM8jC97/yQu\n'\'c32WukI7eBZoA12kargSnzdv5m5rZZpd+NznSSpoDArOAONKVlzr25A1+aZbix2m\n'\'KRbQS5w9o1N2BriQuSzd8gL0Y0zEk3VkOWXEL+0yFUT144HnErnD+xnJtHe11yPO\n'\'2fEzYaGiilh0ddL26PXTugXMZN/8fRVHP50P2OG0SvFpC7vghlLp4VFM1/r3UJnv\n'\'L6Oz3ALc6dhxZEKQucqlpj8l1UegszQToopemtIj0qXTHw2+uUnkUyWIPjPC+wdO\n'\'AoaprFTRAgMBAAECggEAE0HCxV/N1Q1h+1OeDDGL5+74yjKSFKyb/vTVcaPCrmaH\n'\'fPvp0ddOvMZJ4FDMAsiQS6/n4gQ7EKKEnYmwTqj4eUYW8yxGUn3f0YbPHbZT+Mkj\n'\'z5woi3nMKi/MxCGDQZX4Ow3xUQlITUqibsfWcFHis8c4mTqdh4qj7xJzehD2PVYF\n'\'gNHZsvVj6MltjBDAVwV1IlGoHjuElm6vuzkfX7phxcA1B4ZqdYY17yCXUnvui46z\n'\'Xn2kUTOOUCEgfgvGa9E+l4OtdXi5IxjaSraU+dlg2KsE4TpCuN2MEVkeR5Ms3Y7Q\n'\'jgJl8vlNFJDQpbFukLcYwG7rO5N5dQ6WWfVia/5XgQKBgQD74at/bXAPrh9NxPmz\n'\'i1oqCHMDoM9sz8xIMZLF9YVu3Jf8ux4xVpRSnNy5RU1gl7ZXbpdgeIQ4v04zy5aw\n'\'8T4tu9K3XnR3UXOy25AK0q+cnnxZg3kFQm+PhtOCKEFjPHrgo2MUfnj+EDddod7N\n'\'JQr9q5rEFbqHupFPpWlqCa3QmQKBgQDldWUGokNaEpmgHDMnHxiibXV5LQhzf8Rq\n'\'gJIQXb7R9EsTSXEvsDyqTBb7PHp2Ko7rZ5YQfyf8OogGGjGElnPoU/a+Jij1gVFv\n'\'kZ064uXAAISBkwHdcuobqc5EbG3ceyH46F+FBFhqM8KcbxJxx08objmh58+83InN\n'\'P9Qr25Xw+QKBgEGXMHuMWgQbSZeM1aFFhoMvlBO7yogBTKb4Ecpu9wI5e3Kan3Al\n'\'pZYltuyf+VhP6XG3IMBEYdoNJyYhu+nzyEdMg8CwXg+8LC7FMis/Ve+o7aS5scgG\n'\'1to/N9DK/swCsdTRdzmc/ZDbVC+TuVsebFBGYZTyO5KgqLpezqaIQrTxAoGALFCU\n'\'10glO9MVyl9H3clap5v+MQ3qcOv/EhaMnw6L2N6WVT481tnxjW4ujgzrFcE4YuxZ\n'\'hgwYu9TOCmeqopGwBvGYWLbj+C4mfSahOAs0FfXDoYazuIIGBpuv03UhbpB1Si4O\n'\'rJDfRnuCnVWyOTkl54gKJ2OusinhjztBjcrV1XkCgYEA3qNi4uBsPdyz9BZGb/3G\n'\'rOMSw0CaT4pEMTLZqURmDP/0hxvTk1polP7O/FYwxVuJnBb6mzDa0xpLFPTpIAnJ\n'\'YXB8xpXU69QVh+EBbemdJWOd+zp5UCfXvb2shAeG3Tn/Dz4cBBMEUutbzP+or0nG\n'\'vSXnRLaxQhooWm+IuX9SuBQ=\n'\'-----END PRIVATE KEY-----\n'def start_https_server(ota_image_dir: str, server_ip: str, server_port: int, server_file: str = None, key_file: str = None) -> None:os.chdir(ota_image_dir)if server_file is None:server_file = os.path.join(ota_image_dir, 'server_cert.pem')cert_file_handle = open(server_file, 'w+')cert_file_handle.write(server_cert)cert_file_handle.close()if key_file is None:key_file = os.path.join(ota_image_dir, 'server_key.pem')key_file_handle = open('server_key.pem', 'w+')key_file_handle.write(server_key)key_file_handle.close()httpd = http.server.HTTPServer((server_ip, server_port), http.server.SimpleHTTPRequestHandler)httpd.socket = ssl.wrap_socket(httpd.socket,keyfile=key_file,certfile=server_file, server_side=True)httpd.serve_forever()def check_sha256(sha256_expected: str, sha256_reported: str) -> None:print('sha256_expected: %s' % (sha256_expected))print('sha256_reported: %s' % (sha256_reported))if sha256_expected not in sha256_reported:raise ValueError('SHA256 mismatch')else:print('SHA256 expected and reported are the same')def calc_all_sha256(dut: Dut) -> Tuple[str, str]:bootloader_path = os.path.join(dut.app.binary_path, 'bootloader', 'bootloader.bin')sha256_bootloader = dut.app.get_sha256(bootloader_path)app_path = os.path.join(dut.app.binary_path, 'simple_ota.bin')sha256_app = dut.app.get_sha256(app_path)return str(sha256_bootloader), str(sha256_app)@pytest.mark.esp32
@pytest.mark.esp32c3
@pytest.mark.esp32s2
@pytest.mark.esp32s3
@pytest.mark.wifi_high_traffic
def test_examples_protocol_simple_ota_example(dut: Dut) -> None:"""steps: |1. join AP/Ethernet2. Fetch OTA image over HTTPS3. Reboot with the new OTA image"""sha256_bootloader, sha256_app = calc_all_sha256(dut)# Start serverthread1 = multiprocessing.Process(target=start_https_server, args=(dut.app.binary_path, '0.0.0.0', 8000))thread1.daemon = Truethread1.start()try:# start testdut.expect('Loaded app from partition at offset 0x10000', timeout=30)check_sha256(sha256_bootloader, str(dut.expect(r'SHA-256 for bootloader:\s+([a-f0-9]){64}')[0]))check_sha256(sha256_app, str(dut.expect(r'SHA-256 for current firmware:\s+([a-f0-9]){64}')[0]))# Parse IP address of STAif dut.app.sdkconfig.get('EXAMPLE_WIFI_SSID_PWD_FROM_STDIN') is True:env_name = 'wifi_high_traffic'dut.expect('Please input ssid password:')ap_ssid = get_env_config_variable(env_name, 'ap_ssid')ap_password = get_env_config_variable(env_name, 'ap_password')dut.write(f'{ap_ssid} {ap_password}')try:ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode()print('Connected to AP/Ethernet with IP: {}'.format(ip_address))except pexpect.exceptions.TIMEOUT:raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet')host_ip = get_host_ip4_by_dest_ip(ip_address)dut.expect('Starting OTA example task', timeout=30)print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin'))dut.write('https://' + host_ip + ':8000/simple_ota.bin')dut.expect('OTA Succeed, Rebooting...', timeout=60)# after rebootdut.expect('Loaded app from partition at offset 0x110000', timeout=30)dut.expect('OTA example app_main start', timeout=10)finally:thread1.terminate()@pytest.mark.esp32
@pytest.mark.esp32c3
@pytest.mark.esp32s2
@pytest.mark.esp32s3
@pytest.mark.ethernet_ota
@pytest.mark.parametrize('config', ['spiram',], indirect=True)
def test_examples_protocol_simple_ota_example_ethernet_with_spiram_config(dut: Dut) -> None:"""steps: |1. join AP/Ethernet2. Fetch OTA image over HTTPS3. Reboot with the new OTA image"""# Start serverthread1 = multiprocessing.Process(target=start_https_server, args=(dut.app.binary_path, '0.0.0.0', 8000))thread1.daemon = Truethread1.start()try:# start testdut.expect('Loaded app from partition at offset 0x10000', timeout=30)try:ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode()print('Connected to AP/Ethernet with IP: {}'.format(ip_address))except pexpect.exceptions.TIMEOUT:raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet')host_ip = get_host_ip4_by_dest_ip(ip_address)dut.expect('Starting OTA example task', timeout=30)print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin'))dut.write('https://' + host_ip + ':8000/simple_ota.bin')dut.expect('OTA Succeed, Rebooting...', timeout=60)# after rebootdut.expect('Loaded app from partition at offset 0x110000', timeout=30)dut.expect('OTA example app_main start', timeout=10)finally:thread1.terminate()@pytest.mark.esp32
@pytest.mark.esp32c3
@pytest.mark.flash_encryption_wifi_high_traffic
@pytest.mark.nightly_run
@pytest.mark.parametrize('config', ['flash_enc_wifi',], indirect=True)
@pytest.mark.parametrize('skip_autoflash', ['y'], indirect=True)
def test_examples_protocol_simple_ota_example_with_flash_encryption_wifi(dut: Dut) -> None:"""steps: |1. join AP/Ethernet2. Fetch OTA image over HTTPS3. Reboot with the new OTA image"""# start test# Erase flashdut.serial.erase_flash()dut.serial.flash()# Start serverthread1 = multiprocessing.Process(target=start_https_server, args=(dut.app.binary_path, '0.0.0.0', 8000))thread1.daemon = Truethread1.start()try:dut.expect('Loaded app from partition at offset 0x20000', timeout=30)dut.expect('Flash encryption mode is DEVELOPMENT', timeout=10)# Parse IP address of STAif dut.app.sdkconfig.get('EXAMPLE_WIFI_SSID_PWD_FROM_STDIN') is True:env_name = 'flash_encryption_wifi_high_traffic'dut.expect('Please input ssid password:')ap_ssid = get_env_config_variable(env_name, 'ap_ssid')ap_password = get_env_config_variable(env_name, 'ap_password')dut.write(f'{ap_ssid} {ap_password}')try:ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode()print('Connected to AP/Ethernet with IP: {}'.format(ip_address))except pexpect.exceptions.TIMEOUT:raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet')host_ip = get_host_ip4_by_dest_ip(ip_address)dut.expect('Starting OTA example task', timeout=30)print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin'))dut.write('https://' + host_ip + ':8000/simple_ota.bin')dut.expect('OTA Succeed, Rebooting...', timeout=60)# after rebootdut.expect('Loaded app from partition at offset 0x120000', timeout=30)dut.expect('Flash encryption mode is DEVELOPMENT', timeout=10)dut.expect('OTA example app_main start', timeout=10)finally:thread1.terminate()@pytest.mark.esp32
@pytest.mark.esp32c3
@pytest.mark.esp32s2
@pytest.mark.esp32s3
@pytest.mark.ethernet_ota
@pytest.mark.parametrize('config', ['on_update_no_sb_ecdsa',], indirect=True)
def test_examples_protocol_simple_ota_example_with_verify_app_signature_on_update_no_secure_boot_ecdsa(dut: Dut) -> None:"""steps: |1. join AP/Ethernet2. Fetch OTA image over HTTPS3. Reboot with the new OTA image"""sha256_bootloader, sha256_app = calc_all_sha256(dut)# Start serverthread1 = multiprocessing.Process(target=start_https_server, args=(dut.app.binary_path, '0.0.0.0', 8000))thread1.daemon = Truethread1.start()try:# start testdut.expect('Loaded app from partition at offset 0x20000', timeout=30)check_sha256(sha256_bootloader, str(dut.expect(r'SHA-256 for bootloader:\s+([a-f0-9]){64}')[0]))check_sha256(sha256_app, str(dut.expect(r'SHA-256 for current firmware:\s+([a-f0-9]){64}')[0]))try:ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode()print('Connected to AP/Ethernet with IP: {}'.format(ip_address))except pexpect.exceptions.TIMEOUT:raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet')host_ip = get_host_ip4_by_dest_ip(ip_address)dut.expect('Starting OTA example task', timeout=30)print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin'))dut.write('https://' + host_ip + ':8000/simple_ota.bin')dut.expect('Writing to partition subtype 16 at offset 0x120000', timeout=20)dut.expect('Verifying image signature...', timeout=60)dut.expect('OTA Succeed, Rebooting...', timeout=60)# after rebootdut.expect('Loaded app from partition at offset 0x120000', timeout=20)dut.expect('OTA example app_main start', timeout=10)finally:thread1.terminate()@pytest.mark.esp32
@pytest.mark.esp32c3
@pytest.mark.esp32s2
@pytest.mark.esp32s3
@pytest.mark.ethernet_ota
@pytest.mark.parametrize('config', ['on_update_no_sb_rsa',], indirect=True)
def test_examples_protocol_simple_ota_example_with_verify_app_signature_on_update_no_secure_boot_rsa(dut: Dut) -> None:"""steps: |1. join AP/Ethernet2. Fetch OTA image over HTTPS3. Reboot with the new OTA image"""sha256_bootloader, sha256_app = calc_all_sha256(dut)# Start serverthread1 = multiprocessing.Process(target=start_https_server, args=(dut.app.binary_path, '0.0.0.0', 8000))thread1.daemon = Truethread1.start()try:# start testdut.expect('Loaded app from partition at offset 0x20000', timeout=30)check_sha256(sha256_bootloader, str(dut.expect(r'SHA-256 for bootloader:\s+([a-f0-9]){64}')[0]))check_sha256(sha256_app, str(dut.expect(r'SHA-256 for current firmware:\s+([a-f0-9]){64}')[0]))try:ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode()print('Connected to AP/Ethernet with IP: {}'.format(ip_address))except pexpect.exceptions.TIMEOUT:raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP/Ethernet')host_ip = get_host_ip4_by_dest_ip(ip_address)dut.expect('Starting OTA example task', timeout=30)print('writing to device: {}'.format('https://' + host_ip + ':8000/simple_ota.bin'))dut.write('https://' + host_ip + ':8000/simple_ota.bin')dut.expect('Writing to partition subtype 16 at offset 0x120000', timeout=20)dut.expect('Verifying image signature...', timeout=60)dut.expect('#0 app key digest == #0 trusted key digest', timeout=10)dut.expect('Verifying with RSA-PSS...', timeout=10)dut.expect('Signature verified successfully!', timeout=10)dut.expect('OTA Succeed, Rebooting...', timeout=60)# after rebootdut.expect('Loaded app from partition at offset 0x120000', timeout=20)dut.expect('OTA example app_main start', timeout=10)finally:thread1.terminate()if __name__ == '__main__':if sys.argv[2:]:    # if two or more arguments provided:# Usage: example_test.py <image_dir> <server_port> [cert_di>]this_dir = os.path.dirname(os.path.realpath(__file__))bin_dir = os.path.join(this_dir, sys.argv[1])port = int(sys.argv[2])cert_dir = bin_dir if not sys.argv[3:] else os.path.join(this_dir, sys.argv[3])  # optional argumentprint('Starting HTTPS server at "https://:{}"'.format(port))start_https_server(bin_dir, '', port,server_file=os.path.join(cert_dir, 'ca_cert.pem'),key_file=os.path.join(cert_dir, 'ca_key.pem'))

然后在IDF编译环境中,进入有这个python服务器建立脚本的文件夹下,输入命令python -m http.server 8080,然后在电脑浏览器中查看建立的服务器文件,浏览器输入http://127.0.0.1:8080/

这篇关于esp-idf-v5.1.1 空中升级OTA例程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/471152

相关文章

Python UV安装、升级、卸载详细步骤记录

《PythonUV安装、升级、卸载详细步骤记录》:本文主要介绍PythonUV安装、升级、卸载的详细步骤,uv是Astral推出的下一代Python包与项目管理器,主打单一可执行文件、极致性能... 目录安装检查升级设置自动补全卸载UV 命令总结 官方文档详见:https://docs.astral.sh/

苹果macOS 26 Tahoe主题功能大升级:可定制图标/高亮文本/文件夹颜色

《苹果macOS26Tahoe主题功能大升级:可定制图标/高亮文本/文件夹颜色》在整体系统设计方面,macOS26采用了全新的玻璃质感视觉风格,应用于Dock栏、应用图标以及桌面小部件等多个界面... 科技媒体 MACRumors 昨日(6 月 13 日)发布博文,报道称在 macOS 26 Tahoe 中

华为鸿蒙HarmonyOS 5.1官宣7月开启升级! 首批支持名单公布

《华为鸿蒙HarmonyOS5.1官宣7月开启升级!首批支持名单公布》在刚刚结束的华为Pura80系列及全场景新品发布会上,除了众多新品的发布,还有一个消息也点燃了所有鸿蒙用户的期待,那就是Ha... 在今日的华为 Pura 80 系列及全场景新品发布会上,华为宣布鸿蒙 HarmonyOS 5.1 将于 7

ubuntu系统使用官方操作命令升级Dify指南

《ubuntu系统使用官方操作命令升级Dify指南》Dify支持自动化执行、日志记录和结果管理,适用于数据处理、模型训练和部署等场景,今天我们就来看看ubuntu系统中使用官方操作命令升级Dify的方... Dify 是一个基于 docker 的工作流管理工具,旨在简化机器学习和数据科学领域的多步骤工作流。

将Mybatis升级为Mybatis-Plus的详细过程

《将Mybatis升级为Mybatis-Plus的详细过程》本文详细介绍了在若依管理系统(v3.8.8)中将MyBatis升级为MyBatis-Plus的过程,旨在提升开发效率,通过本文,开发者可实现... 目录说明流程增加依赖修改配置文件注释掉MyBATisConfig里面的Bean代码生成使用IDEA生

linux环境openssl、openssh升级流程

《linux环境openssl、openssh升级流程》该文章详细介绍了在Ubuntu22.04系统上升级OpenSSL和OpenSSH的方法,首先,升级OpenSSL的步骤包括下载最新版本、安装编译... 目录一.升级openssl1.官网下载最新版openssl2.安装编译环境3.下载后解压安装4.备份

怎么关闭Ubuntu无人值守升级? Ubuntu禁止自动更新的技巧

《怎么关闭Ubuntu无人值守升级?Ubuntu禁止自动更新的技巧》UbuntuLinux系统禁止自动更新的时候,提示“无人值守升级在关机期间,请不要关闭计算机进程”,该怎么解决这个问题?详细请看... 本教程教你如何处理无人值守的升级,即 Ubuntu linux 的自动系统更新。来源:https://

你的华为手机升级了吗? 鸿蒙NEXT多连推5.0.123版本变化颇多

《你的华为手机升级了吗?鸿蒙NEXT多连推5.0.123版本变化颇多》现在的手机系统更新可不仅仅是修修补补那么简单了,华为手机的鸿蒙系统最近可是动作频频,给用户们带来了不少惊喜... 为了让用户的使用体验变得很好,华为手机不仅发布了一系列给力的新机,还在操作系统方面进行了疯狂的发力。尤其是近期,不仅鸿蒙O

macOS升级后SVN升级

问题 svn: error: The subversion command line tools are no longer provided by Xcode. 解决 sudo chown -R $(whoami) /usr/local/Cellar brew install svn

Golang支持平滑升级的HTTP服务

前段时间用Golang在做一个HTTP的接口,因编译型语言的特性,修改了代码需要重新编译可执行文件,关闭正在运行的老程序,并启动新程序。对于访问量较大的面向用户的产品,关闭、重启的过程中势必会出现无法访问的情况,从而影响用户体验。 使用Golang的系统包开发HTTP服务,是无法支持平滑升级(优雅重启)的,本文将探讨如何解决该问题。 一、平滑升级(优雅重启)的一般思路 一般情况下,要实现平滑