package plain import ( "git.noahlan.cn/noahlan/nnet" "git.noahlan.cn/noahlan/nnet/connection" "git.noahlan.cn/noahlan/nnet/packet" ) func withPipeline() nnet.RunOption { return func(ngin *nnet.Engine) { ngin.Pipeline().Inbound().PushFront(func(conn *connection.Connection, v any) error { _, ok := v.(*Packet) if !ok { return packet.ErrWrongPacketType } if conn.Status() != connection.StatusWorking { conn.SetStatus(connection.StatusWorking) } return nil }) } }