當前位置:首頁 » 操作系統 » QMD源碼

QMD源碼

發布時間: 2023-07-06 19:37:23

⑴ IPFS(四) 源碼解讀之-p2p

package p2p

import (
"context"
"errors"
"time"

net "gx/ipfs//go-libp2p-net"
manet "gx/ipfs//go-multiaddr-net"
ma "gx/ipfs//go-multiaddr"
pro "gx/ipfs//go-libp2p-protocol"
pstore "gx/ipfs//go-libp2p-peerstore"
p2phost "gx/ipfs//go-libp2p-host"
peer "gx/ipfs//go-libp2p-peer"
)
//P2P結構保存當前正在運行的流/監聽器的信息
// P2P structure holds information on currently running streams/listeners
type P2P struct {
//監聽器
Listeners ListenerRegistry
//數據流
Streams StreamRegistry
//節點ID
identity peer.ID
//節點地址
peerHost p2phost.Host
//一個線程安全的對等節點存儲
peerstore pstore.Peerstore
}
//創建一個新的p2p結構
// NewP2P creates new P2P struct
//這個新的p2p結構不包含p2p結構中的監聽器和數據流
func NewP2P(identity peer.ID, peerHost p2phost.Host, peerstore pstore.Peerstore) *P2P {
return &P2P{
identity: identity,
peerHost: peerHost,
peerstore: peerstore,
}
}
//新建一個數據流 工具方法 構建一個有節點id,內容和協議的流
func (p2p P2P) newStreamTo(ctx2 context.Context, p peer.ID, protocol string) (net.Stream, error) {
//30s 後會自動timeout
ctx, cancel := context.WithTimeout(ctx2, time.Second
30) //TODO: configurable?
defer cancel()
err := p2p.peerHost.Connect(ctx, pstore.PeerInfo{ID: p})
if err != nil {
return nil, err
}

return p2p.peerHost.NewStream(ctx2, p, pro.ID(protocol))
}
//對話為遠程監聽器創建新的P2P流
//創建一個新的p2p流實現對對話的監聽
// Dial creates new P2P stream to a remote listener
//Multiaddr是一種跨協議、跨平台的表示格式的互聯網地址。它強調明確性和自我描述。
//對內接收
func (p2p P2P) Dial(ctx context.Context, addr ma.Multiaddr, peer peer.ID, proto string, bindAddr ma.Multiaddr) ( ListenerInfo, error) {
//獲取一些節點信息 network, host, nil
lnet, _, err := manet.DialArgs(bindAddr)
if err != nil {
return nil, err
}
//監聽信息
listenerInfo := ListenerInfo{
//節點身份
Identity: p2p.identity,
////應用程序協議標識符。
Protocol: proto,
}
//調用newStreamTo 通過ctx(內容) peer(節點id) proto(協議標識符) 參數獲取一個新的數據流
remote, err := p2p.newStreamTo(ctx, peer, proto)
if err != nil {
return nil, err
}
//network協議標識
switch lnet {
//network為"tcp", "tcp4", "tcp6"
case "tcp", "tcp4", "tcp6":
//從監聽器獲取新的信息 nla.Listener, nil
listener, err := manet.Listen(bindAddr)
if err != nil {
if err2 := remote.Reset(); err2 != nil {
return nil, err2
}
return nil, err
}
//將獲取的新信息保存到listenerInfo
listenerInfo.Address = listener.Multiaddr()
listenerInfo.Closer = listener
listenerInfo.Running = true
//開啟接受
go p2p.doAccept(&listenerInfo, remote, listener)

default:
return nil, errors.New("unsupported protocol: " + lnet)
}

return &listenerInfo, nil
}
//
func (p2p *P2P) doAccept(listenerInfo *ListenerInfo, remote net.Stream, listener manet.Listener) {
//關閉偵聽器並刪除流處理程序
defer listener.Close()
//Returns a Multiaddr friendly Conn
//一個有好的 Multiaddr 連接
local, err := listener.Accept()
if err != nil {
return
}

stream := StreamInfo{
//連接協議
Protocol: listenerInfo.Protocol,
//定位節點
LocalPeer: listenerInfo.Identity,
//定位節點地址
LocalAddr: listenerInfo.Address,
//遠程節點
RemotePeer: remote.Conn().RemotePeer(),
//遠程節點地址
RemoteAddr: remote.Conn().RemoteMultiaddr(),
//定位
Local: local,
//遠程
Remote: remote,
//注冊碼
Registry: &p2p.Streams,
}
//注冊連接信息
p2p.Streams.Register(&stream)
//開啟節點廣播
stream.startStreaming()
}
//偵聽器將流處理程序包裝到偵聽器中
// Listener wraps stream handler into a listener
type Listener interface {
Accept() (net.Stream, error)
Close() error
}
//P2PListener保存關於偵聽器的信息
// P2PListener holds information on a listener
type P2PListener struct {
peerHost p2phost.Host
conCh chan net.Stream
proto pro.ID
ctx context.Context
cancel func()
}
//等待偵聽器的連接
// Accept waits for a connection from the listener
func (il *P2PListener) Accept() (net.Stream, error) {
select {
case c := <-il.conCh:
return c, nil
case <-il.ctx.Done():
return nil, il.ctx.Err()
}
}
//關閉偵聽器並刪除流處理程序
// Close closes the listener and removes stream handler
func (il *P2PListener) Close() error {
il.cancel()
il.peerHost.RemoveStreamHandler(il.proto)
return nil
}
// Listen創建新的P2PListener
// Listen creates new P2PListener
func (p2p P2P) registerStreamHandler(ctx2 context.Context, protocol string) ( P2PListener, error) {
ctx, cancel := context.WithCancel(ctx2)

list := &P2PListener{
peerHost: p2p.peerHost,
proto: pro.ID(protocol),
conCh: make(chan net.Stream),
ctx: ctx,
cancel: cancel,
}

p2p.peerHost.SetStreamHandler(list.proto, func(s net.Stream) {
select {
case list.conCh <- s:
case <-ctx.Done():
s.Reset()
}
})

return list, nil
}
// NewListener創建新的p2p偵聽器
// NewListener creates new p2p listener
//對外廣播
func (p2p P2P) NewListener(ctx context.Context, proto string, addr ma.Multiaddr) ( ListenerInfo, error) {
//調用registerStreamHandler 構造一個新的listener
listener, err := p2p.registerStreamHandler(ctx, proto)
if err != nil {
return nil, err
}
//構造新的listenerInfo
listenerInfo := ListenerInfo{
Identity: p2p.identity,
Protocol: proto,
Address: addr,
Closer: listener,
Running: true,
Registry: &p2p.Listeners,
}

go p2p.acceptStreams(&listenerInfo, listener)
//注冊連接信息
p2p.Listeners.Register(&listenerInfo)

return &listenerInfo, nil
}
//接受流
func (p2p *P2P) acceptStreams(listenerInfo *ListenerInfo, listener Listener) {
for listenerInfo.Running {
//一個有好的 遠程 連接
remote, err := listener.Accept()
if err != nil {
listener.Close()
break
}

}
//取消注冊表中的p2p偵聽器
p2p.Listeners.Deregister(listenerInfo.Protocol)
}
// CheckProtoExists檢查是否注冊了協議處理程序
// mux處理程序
// CheckProtoExists checks whether a protocol handler is registered to
// mux handler
func (p2p *P2P) CheckProtoExists(proto string) bool {
protos := p2p.peerHost.Mux().Protocols()

for _, p := range protos {
if p != proto {
continue
}
return true
}
return false
}

php 網站程序里邊有個license的授權文件,源碼是這樣的那位大哥幫我破解一下:50分送上

把所有涉及到變數的地方,都輸了一下變數值即可。目測是eval執行一估base64解密的代碼

⑶ php解密問題

最後解密結果是:

</td>
</tr>
</table>

</div>
</div>
</div>
</div>

</div>
</div>
<!-- Content Box END -->

</div>
</div>
</div>
<!-- Header Background END -->

<br /><br />

<!-- Footer START -->
<div id="footer1">
<div id="footer2">
<table width="990" border="0" cellspacing="0" cellpadding="0" class="footer3" height="97"><tr>

<td width="50%" align="left" valign="top">
<div class="footer4">

</div>
</td>

<td width="50%" align="right" valign="top">

<table border="0" cellspacing="0" cellpadding="0" class="footer5" height="23">
<tr>
<td align="left" valign="top"><div class="footer6">Designed by</div></td>
<td width="13" class="footer7"> </td>
<td align="center" valign="top"><div class="footer9"><a href="http://www.renehornig.com/">Webdesigner</a></div></td>
<td width="13" class="footer8"> </td>
</tr>
</table>

</td>

</tr></table>
</div>
</div>
<!-- Footer END -->
===============================
此解密過程還是比較簡單.由於是未授權源碼解密.就不直接貼出過程了.請網路HI我,我告訴你過程.

⑷ PHP源碼解密

請務必試試.
網路一下:清風發明"空格"zend
不錯的話.給加個分吧.我沒半點分數了.

熱點內容
java實現文件上傳到ftp 發布:2025-03-18 02:43:25 瀏覽:401
編程出遊戲 發布:2025-03-18 02:43:15 瀏覽:178
使用公網ip搭建伺服器 發布:2025-03-18 02:34:23 瀏覽:215
android從程序員到架構師之路 發布:2025-03-18 02:32:52 瀏覽:298
高壓存儲罐 發布:2025-03-18 02:23:18 瀏覽:760
加密卡怎麼模擬 發布:2025-03-18 02:02:08 瀏覽:271
我的世界伺服器水桶搭建 發布:2025-03-18 02:01:21 瀏覽:334
微信存儲到sd卡 發布:2025-03-18 01:34:29 瀏覽:969
eclipse的自動編譯 發布:2025-03-18 01:34:29 瀏覽:368
可以上傳視頻網站 發布:2025-03-18 01:29:17 瀏覽:933