mindxdl--common--utils.go
// Copyright (c) 2021. Huawei Technologies Co., Ltd. All rights reserved.
// Package common define common utils
package common
import (
"errors"
"net/http"
"strconv"
)
// ConvertToUint64 convert string to uint64
func ConvertToUint64(ID string) (uint64, error) {
id, err := strconv.ParseUint(ID, BaseHex, BitSize64)
return id, err
}
// GetHTTPHandler new HTTPHandler with http client
// 1. client with http;
// 2. client with https one way auth;
// 3. client with https two way auth;
func GetHTTPHandler(enableHTTP bool, authMode string) (*HTTPHandler, error) {
// http auth
if enableHTTP {
return &HTTPHandler{
Client: new(http.Client),
}, nil
}
wc := GetWebCertUtil()
if wc == nil {
return nil, errors.New("cannot get https one/two way auth handler because cert util is nil")
}
client, err := wc.GetRequestClient(authMode)
if err != nil {
return nil, err
}
return &HTTPHandler{
Client: client,
}, nil
}
mindxdl--common--utils.go的更多相关文章
- Java-Class-Miniprogram:com.common.utils.miniprogram.Auth
ylbtech-Java-Class-miniprogram:com.common.utils.miniprogram.Auth 1.返回顶部 1.1. package com.ylbtech.com ...
- Java-Class-Miniprogram:com.ylbtech.common.utils.miniprogram.TemplateMessage
ylbtech-Java-Class-Miniprogram:com.ylbtech.common.utils.miniprogram.TemplateMessage 1.返回顶部 1.1. pack ...
- 全网最详细的启动Kafka服务时出现kafka.common.InconsistentBrokerIdException: Configured brokerId 3 doesn't match stored brokerId 1 in meta.properties错误的解决办法(图文详解)
不多说,直接上干货! 问题详情 执行bin/kafka-server-start.sh config/server.properties 时, [kfk@bigdata-pro03 kafka_2.- ...
- Java各种Utils小结
原文地址:http://trinea.iteye.com/blog/1533616 最新内容建议直接访问原文:Android常用的工具类 主要介绍总结的Android开发中常用的工具类,大部分同样适用 ...
- Java Base64Utils ----Utils
Java Base64Utils 目录 Java Base64Utils 7 /** * <html> * <body> * <P> Copyrig ...
- 缓存工具类CacheHelper
代码: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Syst ...
- MVC还是MVVM?或许VMVC更适合WinForm客户端
最近开始重构一个稍嫌古老的C/S项目,原先采用的技术栈是『WinForm』+『WCF』+『EF』.相对于现在铺天盖地的B/S架构来说,看上去似乎和Win95一样古老,很多新入行的,可能就没有见过经典的 ...
- C#限速下载网络文件
代码: using System; using System.Collections.Concurrent; using System.Collections.Generic; using Syste ...
- C#定时执行
代码: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; ...
- 基于Dubbo框架构建分布式服务(一)
Dubbo是Alibaba开源的分布式服务框架,我们可以非常容易地通过Dubbo来构建分布式服务,并根据自己实际业务应用场景来选择合适的集群容错模式,这个对于很多应用都是迫切希望的,只需要通过简单的配 ...
随机推荐
- 第九十二篇:Vue 自定义指令
好家伙, 1.什么是自定义指令? vue官方提供了v-text,v-for,v-model,v-if等常用的指令.除此之外vue还允许开发者自定义指令. 2.自定义指令的分类 vue中的自定义指令分为 ...
- KingbaseES 绑定变量与游标共享
对于重复执行的SQL,需要使用绑定变量,避免SQL的重复解析.但是,并不是说使用了绑定变量,就一定能避免硬解析.具体可以参见:https://www.cnblogs.com/kingbase/p/16 ...
- flannel跨主网络通信方案(UDP、VXLAN、HOST-GW)详解
- 分布式安装部署MinIO
官方文档地址:http://docs.minio.org.cn/docs/master/distributed-minio-quickstart-guide 前提条件:分布式Minio至少需要4个硬盘 ...
- centos7安装sonarqube-9.2.4
官方文档地址:https://docs.sonarqube.org/latest/requirements/requirements/ 使用 sonarqube 对 java 项目代码进行扫描的时候, ...
- FastDFS配置文件思维导图(内含各配置文件详细参数说明)
- 知识广度 vs 知识深度
- 2022IDEA破解
注意 本教程适用于 IntelliJ IDEA 2022.1.2 以下所有版本,请放心食用~ 本教程适用于 JetBrains 全系列产品,包括 IDEA.Pycharm.WebStorm.Phpst ...
- CentOS6/7开机启动配置
最近在配置Linux系统的ntp校时,涉及到开机启动问题,总结一下 两个环境: CentOS release 6.5 (Final) CentOS Linux release 7.9.2009 (Co ...
- 通过刷题HTML遇到的问题
通过刷题HTML遇到的问题 1.有关选择器的权重问题 1.通配符选择器和继承:权重为0, 2.标签选择器:权重为0001 3.类选择器:权重为0010 4.id选择器:权重为0100 5.行内样式:权 ...