Golang入门指南


  • 首页

  • todo

  • 思考

  • life

  • food

  • OS

  • lua

  • redis

  • Golang

  • C

  • TCP/IP

  • ebpf

  • p4

  • OpenVPN

  • IPSec

  • L2TP

  • DNS

  • distributed

  • web

  • OpenWRT

  • 运维

  • Git

  • 鸟哥的私房菜

  • IT杂谈

  • 投资

  • About Me

  • 友情链接

  • FTP

  • 搜索
close

Openwrt LuCI 入门(一)

时间: 2022-10-20   |   分类: OpenWrt     |   阅读: 3872 字 ~8分钟

LuCI基本概念

  • UCI 是 Openwrt 中为实现所有系统配置的一个统一接口,英文名 Unified Configuration Interface,即统一配置接口。轻量级 LUA 语言的官方版本只包括一个精简的核心和最基本的库。这使得 LUA 体积小、启动速度快,从而适合嵌入在别的程序里。 LuCI 即是这两个项目的合体,可以实现路由的网页配置界面。

阅读全文 »

OpenWrt netifd学习笔记

时间: 2022-10-20   |   分类: OpenWrt     |   阅读: 4737 字 ~10分钟

Netifd简介

Netifd是OpenWrt中用于进行网络配置的守护进程,基本上所有网络接口设置以及内核的netlink事件都可以由netifd来处理完成。 在启动netifd之前用户需要将所需的配置写入uci配置文件/etc/config/network中,以告知netifd如何设置这些网络接口,如IP地址、上网类型等。如果在netifd运行过程中需要修改配置,则只需更新并保存/etc/config/network,执行/etc/init.d/network reload,netifd便可根据配置文件差异快速地完成网络接口的更新。

阅读全文 »

Openwrt ubus实现进程间通信举例

时间: 2022-10-20   |   分类: OpenWrt     |   阅读: 3994 字 ~8分钟

上一篇文章介绍了ubus的组件和实现原理,本文通过代码实例介绍使用ubus进行进程间通信的三种方式。

  1. invoke的方式实现端对端通信 最简单的情景就是一个提供服务的server端,一个请求服务的client端,client请求server的服务。 下面的例子中,server注册了一个名为“scan_prog”的对象,该对象中提供一个“scan”方法: ubus_invoke.h:
#ifndef __UBUS_INVOKE_H__
#define __UBUS_INVOKE_H__
#include <json/json.h>
#include <libubox/blobmsg_json.h>
 
 
struct prog_attr {
	char name[64];
	int chn_id;
};
#define PROG_MAX	8
 
 
#endif  /* __UBUS_INVOKE_H__ */

invoke_server.c:

阅读全文 »

OpenWrt 使用 ubus实现进程通信

时间: 2022-10-20   |   分类: OpenWrt     |   阅读: 3627 字 ~8分钟

ubus为openwrt平台开发中的进程间通信提供了一个通用的框架。它让进程间通信的实现变得非常简单,并且ubus具有很强的可移植性,可以很方便的移植到其他linux平台上使用。本文描述了ubus的实现原理和整体框架。

阅读全文 »

JSON-RPC

时间: 2022-10-20   |   分类: web     |   阅读: 1047 字 ~3分钟

JSON-RPC

From Wikipedia, the free encyclopedia

Jump to navigationJump to search

JSON-RPC is a remote procedure call protocol encoded in JSON. It is similar to the XML-RPC protocol, defining only a few data types and commands. JSON-RPC allows for notifications (data sent to the server that does not require a response) and for multiple calls to be sent to the server which may be answered asynchronously.

Version Description Dated
1.0 Original version 2005
1.1 WD Working draft. Adds named parameters, adds specific error codes, and adds introspection functions. 2006-08-07
1.1 Alt Suggestion for a simple JSON-RPC 1.1. Alternative proposal to 1.1 WD. 2007-05-06
1.1 Object Specification Object Specification. Alternative proposal to 1.1 WD/1.1ALT. 2007-07-30
1.2 Proposal. A later revision of this document was renamed to 2.0. 2007-12-27
2.0 Specification proposal 2009-05-24
2.0 (Revised-) Specification 2010-03-26

Usage

JSON-RPC works by sending a request to a server implementing this protocol. The client in that case is typically software intending to call a single method of a remote system. Multiple input parameters can be passed to the remote method as an array or object, whereas the method itself can return multiple output data as well. (This depends on the implemented version.)

阅读全文 »

lua常用函数-打印表

时间: 2022-10-19   |   分类: lua     |   阅读: 74 字 ~1分钟
  • 打印表
function PrintTable(table, key, level)
  level = level or 1
  local indent = ""
  for i = 1, level do
    indent = indent.."  "
  end

  if key ~= nil then
    print(indent..key.." ".."=".." ".."{")
  else
    print(indent .. "{")
  end

  for k,v in pairs(table) do
     if type(v) == "table" then
        PrintTable(v, key, level + 1)
     else
        local content = string.format("%s%s = %s", indent .. "  ",tostring(k), tostring(v))
      print(content)  
      end
  end
  print(indent .. "}")
end

CMakeLists.txt注释

时间: 2022-10-19   |   分类: c     |   阅读: 51 字 ~1分钟

单行注释:使用“#” 多行注释:使用“#[[ ]]” 以下图为例 注释前 注释后

以上内容转载自互联网,若有侵权请联系站长删除

C语言获取系统时间并转换成字符串

时间: 2022-10-19   |   分类: c     |   阅读: 26 字 ~1分钟
 #include <time.h>
 #include <stdio.h>
 
 int
 main(int argc, char *argv[]) {
   time_t tt = time(0);
   char buf[32] = {0};
   strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", localtime(&tt));
   return 0;
 }
25 26 27 28 29 30 31 32 33

日志
分类
标签
RSS 订阅
GitHub
© 2009 - 2025
粤ICP备2021068940号-1 粤公网安备44011302003059
0%